From 7e631c08a9794288cbfab954b08138570d4c02dc Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 16 Apr 2025 19:24:00 +0000 Subject: [PATCH] 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. --- fuzz/src/full_stack.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 9ff3b852f9f..5281a933526 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -299,6 +299,14 @@ impl<'a> MoneyLossDetector<'a> { } fn connect_block(&mut self, all_txn: &[Transaction]) { + if self.blocks_connected > 50_000 { + // Connecting blocks is relatively slow, and some commands can connect many blocks. + // This can inflate the total runtime substantially, leading to spurious timeouts. + // Instead, because block connection rate is expected to be limited by PoW, simply + // start ignoring blocks after the first 50k. + return; + } + let mut txdata = Vec::with_capacity(all_txn.len()); for (idx, tx) in all_txn.iter().enumerate() { let txid = tx.compute_txid();