From 01dde6b20578616af7620a2180ee6b5db0ca4793 Mon Sep 17 00:00:00 2001 From: marcofleon Date: Tue, 11 Aug 2026 17:05:34 +0100 Subject: [PATCH] fuzz: Fix assertion in txorphan EraseTx calls LimitOrphans, which may evict announcements from a peer that didn't announce the erased transaction, causing that peer's usage to decrease. Relax the assertion in the EraseTx branch that claimed usage of a non-announcer peer is unchanged. Also, add assertions for the other cases. --- src/test/fuzz/txorphan.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/fuzz/txorphan.cpp b/src/test/fuzz/txorphan.cpp index 9466f776249..24366808df6 100644 --- a/src/test/fuzz/txorphan.cpp +++ b/src/test/fuzz/txorphan.cpp @@ -173,11 +173,13 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage) { auto bytes_from_peer_before{orphanage->UsageByPeer(peer_id)}; Assert(have_tx == orphanage->EraseTx(tx->GetWitnessHash())); - // After EraseTx, the orphanage may trim itself, so all peers' usage may have gone up or down. - if (have_tx) { - if (!have_tx_and_peer) { - Assert(orphanage->UsageByPeer(peer_id) == bytes_from_peer_before); - } + // After EraseTx, the orphanage may trim itself, so any peer's usage may decrease. + if (!have_tx) { + Assert(orphanage->UsageByPeer(peer_id) == bytes_from_peer_before); + } else if (have_tx_and_peer) { + Assert(orphanage->UsageByPeer(peer_id) <= bytes_from_peer_before - tx_weight); + } else { + Assert(orphanage->UsageByPeer(peer_id) <= bytes_from_peer_before); } } have_tx = orphanage->HaveTx(tx->GetWitnessHash());