fuzz: Fix txorphan timeout by limiting block weight

This commit is contained in:
marcofleon
2026-05-14 12:32:04 +01:00
parent cad5f56045
commit 004a7e3cfb

View File

@@ -197,9 +197,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);