[p2p] filter 1p1c for child txid in recent rejects

Avoid the fuzzer situation where:
1. Orphanage has 2 transactions with the same txid, one with witness,
   one without witness.
2. The transaction with witness is found to have
   `TX_INPUTS_NOT_STANDARD` error. The txid is added to recent rejects
filter, and the tx with witness is deleted from orphanage.
3. A low feerate parent is found. Find1P1CPackage finds the transaction
   with no witness in orphanage, and returns the package.
4. net_processing has just been handed a package in which the child is
   already in recent rejects.
pull/30110/head
glozow 3 weeks ago
parent 5269d57e6d
commit f803c8ce8d

@ -253,7 +253,8 @@ std::optional<PackageToValidate> TxDownloadManagerImpl::Find1P1CPackage(const CT
// most recent) one efficiently. // most recent) one efficiently.
for (const auto& child : cpfp_candidates_same_peer) { for (const auto& child : cpfp_candidates_same_peer) {
Package maybe_cpfp_package{ptx, child}; Package maybe_cpfp_package{ptx, child};
if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package))) { if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package)) &&
!RecentRejectsFilter().contains(child->GetHash().ToUint256())) {
return PackageToValidate{ptx, child, nodeid, nodeid}; return PackageToValidate{ptx, child, nodeid, nodeid};
} }
} }
@ -280,7 +281,8 @@ std::optional<PackageToValidate> TxDownloadManagerImpl::Find1P1CPackage(const CT
// cached in m_lazy_recent_rejects_reconsiderable. // cached in m_lazy_recent_rejects_reconsiderable.
const auto [child_tx, child_sender] = cpfp_candidates_different_peer.at(index); const auto [child_tx, child_sender] = cpfp_candidates_different_peer.at(index);
Package maybe_cpfp_package{ptx, child_tx}; Package maybe_cpfp_package{ptx, child_tx};
if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package))) { if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package)) &&
!RecentRejectsFilter().contains(child_tx->GetHash().ToUint256())) {
return PackageToValidate{ptx, child_tx, nodeid, child_sender}; return PackageToValidate{ptx, child_tx, nodeid, child_sender};
} }
} }

Loading…
Cancel
Save