Skip to content

Commit f803c8c

Browse files
committed
[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.
1 parent 5269d57 commit f803c8c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/node/txdownloadman_impl.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ std::optional<PackageToValidate> TxDownloadManagerImpl::Find1P1CPackage(const CT
253253
// most recent) one efficiently.
254254
for (const auto& child : cpfp_candidates_same_peer) {
255255
Package maybe_cpfp_package{ptx, child};
256-
if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package))) {
256+
if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package)) &&
257+
!RecentRejectsFilter().contains(child->GetHash().ToUint256())) {
257258
return PackageToValidate{ptx, child, nodeid, nodeid};
258259
}
259260
}
@@ -280,7 +281,8 @@ std::optional<PackageToValidate> TxDownloadManagerImpl::Find1P1CPackage(const CT
280281
// cached in m_lazy_recent_rejects_reconsiderable.
281282
const auto [child_tx, child_sender] = cpfp_candidates_different_peer.at(index);
282283
Package maybe_cpfp_package{ptx, child_tx};
283-
if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package))) {
284+
if (!RecentRejectsReconsiderableFilter().contains(GetPackageHash(maybe_cpfp_package)) &&
285+
!RecentRejectsFilter().contains(child_tx->GetHash().ToUint256())) {
284286
return PackageToValidate{ptx, child_tx, nodeid, child_sender};
285287
}
286288
}

0 commit comments

Comments
 (0)