]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Limit `full_stack` fuzz runtime by limiting block connection ops 2024-07-fst-bolt12
authorMatt Corallo <git@bluematt.me>
Wed, 6 Nov 2024 15:41:47 +0000 (15:41 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 6 Nov 2024 15:41:47 +0000 (15:41 +0000)
fuzz/src/full_stack.rs

index be40af501d65d1756d277c8f366b4548b8ab180f..6fd444c2b42a05b4f8dd55ad0dd462a65bf0f530 100644 (file)
@@ -309,6 +309,14 @@ impl<'a> MoneyLossDetector<'a> {
        }
 
        fn connect_block(&mut self, all_txn: &[Transaction]) {
+               if self.blocks_connected > 100_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 100k.
+                       return;
+               }
+
                let mut txdata = Vec::with_capacity(all_txn.len());
                for (idx, tx) in all_txn.iter().enumerate() {
                        let txid = tx.compute_txid();