From f803c8ce8dd88d9d0fd7857f63d76045b1e2bcaa Mon Sep 17 00:00:00 2001 From: glozow Date: Tue, 15 Oct 2024 18:22:11 +0100 Subject: [PATCH] [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. --- src/node/txdownloadman_impl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node/txdownloadman_impl.cpp b/src/node/txdownloadman_impl.cpp index 6078f91c0a3..f9635d049ad 100644 --- a/src/node/txdownloadman_impl.cpp +++ b/src/node/txdownloadman_impl.cpp @@ -253,7 +253,8 @@ std::optional TxDownloadManagerImpl::Find1P1CPackage(const CT // most recent) one efficiently. for (const auto& child : cpfp_candidates_same_peer) { 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}; } } @@ -280,7 +281,8 @@ std::optional TxDownloadManagerImpl::Find1P1CPackage(const CT // cached in m_lazy_recent_rejects_reconsiderable. const auto [child_tx, child_sender] = cpfp_candidates_different_peer.at(index); 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}; } }