From: Matt Corallo Date: Mon, 25 Dec 2023 00:54:45 +0000 (+0000) Subject: Disable fuzzing-reachable debug assertions in `ChannelMonitor`s X-Git-Tag: v0.0.123-beta~80^2~7 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=248e2f5be5b415d794fe10123b871ec45ad348bb;p=rust-lightning Disable fuzzing-reachable debug assertions in `ChannelMonitor`s --- diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 55b7b503f..fb5c18eae 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -3172,7 +3172,11 @@ impl ChannelMonitorImpl { (htlc, htlc_source.as_ref().map(|htlc_source| htlc_source.as_ref())) ), logger); } else { - debug_assert!(false, "We should have per-commitment option for any recognized old commitment txn"); + // Our fuzzers aren't contrained by pesky things like valid signatures, so can + // spend our funding output with a transaction which doesn't match our past + // commitment transactions. Thus, we can only debug-assert here when not + // fuzzing. + debug_assert!(cfg!(fuzzing), "We should have per-commitment option for any recognized old commitment txn"); fail_unbroadcast_htlcs!(self, "revoked counterparty", commitment_txid, tx, height, block_hash, [].iter().map(|reference| *reference), logger); } diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index 59c98f05e..108ff0093 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -806,7 +806,9 @@ impl OnchainTxHandler claim_id }, }; - debug_assert!(self.pending_claim_requests.get(&claim_id).is_none()); + // Because fuzzing can cause hash collisions, we can end up with conflicting claim + // ids here, so we only assert when not fuzzing. + debug_assert!(cfg!(fuzzing) || self.pending_claim_requests.get(&claim_id).is_none()); for k in req.outpoints() { log_info!(logger, "Registering claiming request for {}:{}", k.txid, k.vout); self.claimable_outpoints.insert(k.clone(), (claim_id, conf_height));