Skip to content

Commit 0fd6b91

Browse files
joostjagerclaude
andcommitted
Skip weight lower-bound assertions when fuzzing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent accbb97 commit 0fd6b91

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • lightning/src/events/bump_transaction

lightning/src/events/bump_transaction/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,9 @@ impl<B: BroadcasterInterface, C: CoinSelectionSource, SP: SignerProvider, L: Log
485485
// Our estimate should be within a 1% error margin of the actual weight and we should
486486
// never underestimate.
487487
assert!(expected_signed_tx_weight >= signed_tx_weight);
488+
// When fuzzing, signatures are trivially small so the actual weight can be
489+
// significantly less than estimated. Skip the lower-bound check.
490+
#[cfg(not(fuzzing))]
488491
assert!(expected_signed_tx_weight * 99 / 100 <= signed_tx_weight);
489492

490493
let expected_package_fee = Amount::from_sat(fee_for_weight(
@@ -733,6 +736,9 @@ impl<B: BroadcasterInterface, C: CoinSelectionSource, SP: SignerProvider, L: Log
733736
// Our estimate should be within a 2% error margin of the actual weight and we should
734737
// never underestimate.
735738
assert!(expected_signed_tx_weight >= signed_tx_weight);
739+
// When fuzzing, signatures are trivially small so the actual weight can be
740+
// significantly less than estimated. Skip the lower-bound check.
741+
#[cfg(not(fuzzing))]
736742
assert!(expected_signed_tx_weight * 98 / 100 <= signed_tx_weight);
737743

738744
let expected_signed_tx_fee =

0 commit comments

Comments
 (0)