diff --git a/src/test/fuzz/txorphan.cpp b/src/test/fuzz/txorphan.cpp index f6720ffb897..ef26fe429f3 100644 --- a/src/test/fuzz/txorphan.cpp +++ b/src/test/fuzz/txorphan.cpp @@ -196,9 +196,13 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage) [&] { // Make a block out of txs and then EraseForBlock CBlock block; + int64_t block_weight{0}; int num_txs = fuzzed_data_provider.ConsumeIntegralInRange(0, 1000); for (int i{0}; i < num_txs; ++i) { auto& tx_to_remove = PickValue(fuzzed_data_provider, tx_history); + const auto tx_weight = GetTransactionWeight(*tx_to_remove); + if (block_weight + tx_weight > MAX_BLOCK_WEIGHT) break; + block_weight += tx_weight; block.vtx.push_back(tx_to_remove); } orphanage->EraseForBlock(block);