Skip to content

Commit 0aa3ffd

Browse files
committed
Disable fuzzing-reachable debug assertions in ChannelMonitors
1 parent ab74d7c commit 0aa3ffd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,11 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31483148
(htlc, htlc_source.as_ref().map(|htlc_source| htlc_source.as_ref()))
31493149
), logger);
31503150
} else {
3151-
debug_assert!(false, "We should have per-commitment option for any recognized old commitment txn");
3151+
// Our fuzzers aren't contrained by pesky things like valid signatures, so can
3152+
// spend our funding output with a transaction which doesn't match our past
3153+
// commitment transactions. Thus, we can only debug-assert here when not
3154+
// fuzzing.
3155+
debug_assert!(cfg!(fuzzing), "We should have per-commitment option for any recognized old commitment txn");
31523156
fail_unbroadcast_htlcs!(self, "revoked counterparty", commitment_txid, tx, height,
31533157
block_hash, [].iter().map(|reference| *reference), logger);
31543158
}

lightning/src/chain/onchaintx.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,9 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
806806
claim_id
807807
},
808808
};
809-
debug_assert!(self.pending_claim_requests.get(&claim_id).is_none());
809+
// Because fuzzing can cause hash collisions, we can end up with conflicting claim
810+
// ids here, so we only assert when not fuzzing.
811+
debug_assert!(cfg!(fuzzing) || self.pending_claim_requests.get(&claim_id).is_none());
810812
for k in req.outpoints() {
811813
log_info!(logger, "Registering claiming request for {}:{}", k.txid, k.vout);
812814
self.claimable_outpoints.insert(k.clone(), (claim_id, conf_height));

0 commit comments

Comments
 (0)