mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
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.
This commit is contained in:
parent
e94647ca4e
commit
9878edeeba
1 changed files with 3 additions and 1 deletions
|
@ -2457,7 +2457,9 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
|
|||
|
||||
self.latest_update_id = updates.update_id;
|
||||
|
||||
if ret.is_ok() && self.funding_spend_seen {
|
||||
// Refuse updates after we've detected a spend onchain, but only if we haven't processed a
|
||||
// force closed monitor update yet.
|
||||
if ret.is_ok() && self.funding_spend_seen && self.latest_update_id != CLOSED_CHANNEL_UPDATE_ID {
|
||||
log_error!(logger, "Refusing Channel Monitor Update as counterparty attempted to update commitment after funding was spent");
|
||||
Err(())
|
||||
} else { ret }
|
||||
|
|
Loading…
Add table
Reference in a new issue