mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
[fuzz] orphanage multiple announcer functions
This commit is contained in:
parent
22b023b09d
commit
163aaf285a
1 changed files with 13 additions and 0 deletions
|
@ -128,6 +128,18 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||||
Assert(!have_tx || !add_tx);
|
Assert(!have_tx || !add_tx);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
[&] {
|
||||||
|
bool have_tx = orphanage.HaveTx(tx->GetWitnessHash());
|
||||||
|
bool have_tx_and_peer = orphanage.HaveTxFromPeer(tx->GetWitnessHash(), peer_id);
|
||||||
|
// AddAnnouncer should return false if tx doesn't exist or we already HaveTxFromPeer.
|
||||||
|
{
|
||||||
|
bool added_announcer = orphanage.AddAnnouncer(tx->GetWitnessHash(), peer_id);
|
||||||
|
// have_tx == false -> added_announcer == false
|
||||||
|
Assert(have_tx || !added_announcer);
|
||||||
|
// have_tx_and_peer == true -> added_announcer == false
|
||||||
|
Assert(!have_tx_and_peer || !added_announcer);
|
||||||
|
}
|
||||||
|
},
|
||||||
[&] {
|
[&] {
|
||||||
bool have_tx = orphanage.HaveTx(tx->GetWitnessHash());
|
bool have_tx = orphanage.HaveTx(tx->GetWitnessHash());
|
||||||
// EraseTx should return 0 if m_orphans doesn't have the tx
|
// EraseTx should return 0 if m_orphans doesn't have the tx
|
||||||
|
@ -142,6 +154,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||||
},
|
},
|
||||||
[&] {
|
[&] {
|
||||||
orphanage.EraseForPeer(peer_id);
|
orphanage.EraseForPeer(peer_id);
|
||||||
|
Assert(!orphanage.HaveTxFromPeer(tx->GetWitnessHash(), peer_id));
|
||||||
},
|
},
|
||||||
[&] {
|
[&] {
|
||||||
// test mocktime and expiry
|
// test mocktime and expiry
|
||||||
|
|
Loading…
Add table
Reference in a new issue