[txorphanage] add GetTx so that orphan vin can be read

This commit is contained in:
glozow
2025-01-03 09:04:10 -05:00
parent e810842acd
commit 04448ce32a
4 changed files with 13 additions and 0 deletions

View File

@@ -157,5 +157,8 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
ptx_potential_parent = tx;
}
const bool have_tx{orphanage.HaveTx(tx->GetWitnessHash())};
const bool get_tx_nonnull{orphanage.GetTx(tx->GetWitnessHash()) != nullptr};
Assert(have_tx == get_tx_nonnull);
}
}

View File

@@ -250,7 +250,9 @@ BOOST_AUTO_TEST_CASE(same_txid_diff_witness)
// EraseTx fails as transaction by this wtxid doesn't exist.
BOOST_CHECK_EQUAL(orphanage.EraseTx(mutated_wtxid), 0);
BOOST_CHECK(orphanage.HaveTx(normal_wtxid));
BOOST_CHECK(orphanage.GetTx(normal_wtxid) == child_normal);
BOOST_CHECK(!orphanage.HaveTx(mutated_wtxid));
BOOST_CHECK(orphanage.GetTx(mutated_wtxid) == nullptr);
// Must succeed. Both transactions should be present in orphanage.
BOOST_CHECK(orphanage.AddTx(child_mutated, peer));