Skip to content

Commit fe0a5d9

Browse files
committed
Disable fuzzing-reachable debug assertions in ChannelMonitors
1 parent 3a5d216 commit fe0a5d9

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
@@ -3172,7 +3172,11 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31723172
(htlc, htlc_source.as_ref().map(|htlc_source| htlc_source.as_ref()))
31733173
), logger);
31743174
} else {
3175-
debug_assert!(false, "We should have per-commitment option for any recognized old commitment txn");
3175+
// Our fuzzers aren't contrained by pesky things like valid signatures, so can
3176+
// spend our funding output with a transaction which doesn't match our past
3177+
// commitment transactions. Thus, we can only debug-assert here when not
3178+
// fuzzing.
3179+
debug_assert!(cfg!(fuzzing), "We should have per-commitment option for any recognized old commitment txn");
31763180
fail_unbroadcast_htlcs!(self, "revoked counterparty", commitment_txid, tx, height,
31773181
block_hash, [].iter().map(|reference| *reference), logger);
31783182
}

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)