Skip to content

Commit 7e631c0

Browse files
committed
Limit full_stack fuzz runtime by limiting block connection ops
The `full_stack_target` fuzzer is generally pretty slow, but on some inputs the fuzzer is able to connect hundreds of thousands to millions of blocks, which is by far the slowest operation. In some cases, individual inputs can take tens of minutes to complete, which is not a realistic issue in LDK (we don't expect there to be million-block bursts in Bitcoin) so we simply disable it.
1 parent 0ee1def commit 7e631c0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fuzz/src/full_stack.rs

+8
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,14 @@ impl<'a> MoneyLossDetector<'a> {
299299
}
300300

301301
fn connect_block(&mut self, all_txn: &[Transaction]) {
302+
if self.blocks_connected > 50_000 {
303+
// Connecting blocks is relatively slow, and some commands can connect many blocks.
304+
// This can inflate the total runtime substantially, leading to spurious timeouts.
305+
// Instead, because block connection rate is expected to be limited by PoW, simply
306+
// start ignoring blocks after the first 50k.
307+
return;
308+
}
309+
302310
let mut txdata = Vec::with_capacity(all_txn.len());
303311
for (idx, tx) in all_txn.iter().enumerate() {
304312
let txid = tx.compute_txid();

0 commit comments

Comments
 (0)