Skip to content

Commit b3ab0c3

Browse files
committed
Merge bitcoin/bitcoin#28997: fuzz: txorphan check wtxids using GenTxid::Wtxid not GenTxid::Txid
38816ff 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 bitcoin/bitcoin#28658 ACKs for top commit: naumenkogs: ACK 38816ff dergoegge: ACK 38816ff Tree-SHA512: 5e46a83f2b2a2ac0672a63eb6200b019e01089ab1aa80c4ab869b6fcf27ccf2e84a064e96397f1a1869ccfa43b0c9638cbae681a27c4ca3c96ac71f41262601e
2 parents 1c8893b + 38816ff commit b3ab0c3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/fuzz/txorphan.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,21 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
9191
{
9292
CTransactionRef ref = orphanage.GetTxToReconsider(peer_id);
9393
if (ref) {
94-
bool have_tx = orphanage.HaveTx(GenTxid::Txid(ref->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(ref->GetHash()));
94+
bool have_tx = orphanage.HaveTx(GenTxid::Txid(ref->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(ref->GetWitnessHash()));
9595
Assert(have_tx);
9696
}
9797
}
9898
},
9999
[&] {
100-
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
100+
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
101101
// AddTx should return false if tx is too big or already have it
102102
// tx weight is unknown, we only check when tx is already in orphanage
103103
{
104104
bool add_tx = orphanage.AddTx(tx, peer_id);
105105
// have_tx == true -> add_tx == false
106106
Assert(!have_tx || !add_tx);
107107
}
108-
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
108+
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
109109
{
110110
bool add_tx = orphanage.AddTx(tx, peer_id);
111111
// if have_tx is still false, it must be too big
@@ -114,12 +114,12 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
114114
}
115115
},
116116
[&] {
117-
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
117+
bool have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
118118
// EraseTx should return 0 if m_orphans doesn't have the tx
119119
{
120120
Assert(have_tx == orphanage.EraseTx(tx->GetHash()));
121121
}
122-
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetHash()));
122+
have_tx = orphanage.HaveTx(GenTxid::Txid(tx->GetHash())) || orphanage.HaveTx(GenTxid::Wtxid(tx->GetWitnessHash()));
123123
// have_tx should be false and EraseTx should fail
124124
{
125125
Assert(!have_tx && !orphanage.EraseTx(tx->GetHash()));

0 commit comments

Comments
 (0)