fuzz: Fix txorphan timeout by limiting block weight

Github-Pull: #35289
Rebased-From: 004a7e3cfb
This commit is contained in:
marcofleon
2026-05-14 12:32:04 +01:00
committed by fanquake
parent e379148a7a
commit 7a97580997

View File

@@ -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<unsigned int>(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);