@@ -448,10 +448,10 @@ pub(super) struct Channel<Signer: Sign> {
448448 #[ cfg( any( test, feature = "fuzztarget" ) ) ]
449449 // When receive an HTLC fulfill on an outbound path, we may immediately fulfill the
450450 // corresponding HTLC on the inbound path. If, then, the outbound path channel is
451- // disconnected and reconnected, they may re-broadcast their update_fulfill_htlc,
452- // causing a double-claim. This is fine, but as a sanity check in our failure to
453- // generate the second claim, we check here that the original was a claim, and that we
454- // aren't now trying to fulfill a failed HTLC.
451+ // disconnected and reconnected (before we've exchange commitment_signed and revoke_and_ack
452+ // messages), they may re-broadcast their update_fulfill_htlc, causing a duplicate claim. This
453+ // is fine, but as a sanity check in our failure to generate the second claim, we check here
454+ // that the original was a claim, and that we aren't now trying to fulfill a failed HTLC.
455455 historical_inbound_htlc_fulfills : HashSet < u64 > ,
456456}
457457
@@ -1279,6 +1279,8 @@ impl<Signer: Sign> Channel<Signer> {
12791279 }
12801280 if pending_idx == core:: usize:: MAX {
12811281 #[ cfg( any( test, feature = "fuzztarget" ) ) ]
1282+ // If we failed to find an HTLC to fulfill, make sure it was previously fulfilled and
1283+ // this is simply a duplicate claim, not previously failed and we lost funds.
12821284 debug_assert ! ( self . historical_inbound_htlc_fulfills. contains( & htlc_id_arg) ) ;
12831285 return Ok ( ( None , None ) ) ;
12841286 }
0 commit comments