mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
Merge bitcoin/bitcoin#35972: fuzz: Fix assertion in txorphan
01dde6b205fuzz: Fix assertion in txorphan (marcofleon) Pull request description: `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 should be unchanged. Also, add assertions for the other cases. ACKs for top commit: dergoegge: utACK01dde6b205instagibbs: ACK01dde6b205Tree-SHA512: 2e597b85fd41058c2fa79fa55f0d37e12505065b5e27aba7b9680e0c249a5450e6fa97b45394d6ffe1318f42538134ffa9c423b126c455f6f8e6d8ca59eed4b6
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user