Skip to content

Commit 9878ede

Browse files
committed
Prevent ChannelForceClosed monitor update error after detecting spend
If we detected a spend for a channel onchain prior to handling its `ChannelForceClosed` monitor update, we'd log a concerning error message and return an error unnecessarily. The channel has already been closed, so handling the `ChannelForceClosed` monitor update at this point should be a no-op.
1 parent e94647c commit 9878ede

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,9 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
24572457

24582458
self.latest_update_id = updates.update_id;
24592459

2460-
if ret.is_ok() && self.funding_spend_seen {
2460+
// Refuse updates after we've detected a spend onchain, but only if we haven't processed a
2461+
// force closed monitor update yet.
2462+
if ret.is_ok() && self.funding_spend_seen && self.latest_update_id != CLOSED_CHANNEL_UPDATE_ID {
24612463
log_error!(logger, "Refusing Channel Monitor Update as counterparty attempted to update commitment after funding was spent");
24622464
Err(())
24632465
} else { ret }

0 commit comments

Comments
 (0)