mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge bitcoin/bitcoin#28997: fuzz: txorphan check wtxids using GenTxid::Wtxid not GenTxid::Txid
38816ff64e
fuzz: txorphan check wtxids using GenTxid::Wtxid not GenTxid::Txid (Greg Sanders) Pull request description: Fixes the bugs in the fuzz test with no more changes as an alternative to https://github.com/bitcoin/bitcoin/pull/28658 ACKs for top commit: naumenkogs: ACK38816ff64e
dergoegge: ACK38816ff64e
Tree-SHA512: 5e46a83f2b2a2ac0672a63eb6200b019e01089ab1aa80c4ab869b6fcf27ccf2e84a064e96397f1a1869ccfa43b0c9638cbae681a27c4ca3c96ac71f41262601e
This commit is contained in:
commit
b3ab0c3819
@ -91,13 +91,13 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
{
|
||||
CTransactionRef ref = orphanage.GetTxToReconsider(peer_id);
|
||||
if (ref) {
|
||||
bool have_tx = orphanage.HaveTx(GenTxid::Txid(ref->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(ref->GetHash()));
|
||||
bool have_tx = orphanage.HaveTx(GenTxid::Txid(ref->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(ref->GetWitnessHash()));
|
||||
Assert(have_tx);
|
||||
}
|
||||
}
|
||||
},
|
||||
[&] {
|
||||
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
|
||||
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
|
||||
// AddTx should return false if tx is too big or already have it
|
||||
// tx weight is unknown, we only check when tx is already in orphanage
|
||||
{
|
||||
@ -105,7 +105,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
// have_tx == true -> add_tx == false
|
||||
Assert(!have_tx || !add_tx);
|
||||
}
|
||||
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
|
||||
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
|
||||
{
|
||||
bool add_tx = orphanage.AddTx(tx, peer_id);
|
||||
// if have_tx is still false, it must be too big
|
||||
@ -114,12 +114,12 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
}
|
||||
},
|
||||
[&] {
|
||||
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
|
||||
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
|
||||
// EraseTx should return 0 if m_orphans doesn't have the tx
|
||||
{
|
||||
Assert(have_tx == orphanage.EraseTx(tx->GetHash()));
|
||||
}
|
||||
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
|
||||
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
|
||||
// have_tx should be false and EraseTx should fail
|
||||
{
|
||||
Assert(!have_tx && !orphanage.EraseTx(tx->GetHash()));
|
||||
|
Loading…
Reference in New Issue
Block a user