Skip to content

Commit c95f91b

Browse files
committed
Remove bogus mon_update_id += 1 fulfilling already-fulfilled HTLCs
If we call get_update_fulfill_htlc (in this case via ChannelManager::claim_funds_internal -> Channel::get_update_fulfill_htlc_and_commit) and it finds that we already have a holding-cell pending HTLC claim, it will return no monitor update but leave latest_monitor_update_id incremented. If we later go and add a new monitor update we'll panic as the updates appear to have been applied out-of-order.
1 parent 33b7c90 commit c95f91b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lightning/src/ln/channel.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,8 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
12001200
match pending_update {
12011201
&HTLCUpdateAwaitingACK::ClaimHTLC { htlc_id, .. } => {
12021202
if htlc_id_arg == htlc_id {
1203+
// Make sure we don't leave latest_monitor_update_id incremented here:
1204+
self.latest_monitor_update_id -= 1;
12031205
return Ok((None, None));
12041206
}
12051207
},

0 commit comments

Comments
 (0)