From: Wilmer Paulino Date: Tue, 28 Feb 2023 18:45:48 +0000 (-0800) Subject: Avoid refusing ChannelMonitorUpdates we expect to receive after closing X-Git-Tag: v0.0.115~46^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=00cfc6b82300541ace7eee4625267799183513e8;p=rust-lightning Avoid refusing ChannelMonitorUpdates we expect to receive after closing There is no need to fill the user's logs with errors that are expected to be hit based on specific edge cases, like providing preimages after a monitor has seen a confirmed commitment on-chain. This doesn't really change our behavior – we still apply and persist the state changes resulting from processing these updates regardless of whether they succeed or not. --- diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index df5160df0..97e1e8ee6 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -2373,6 +2373,13 @@ impl ChannelMonitorImpl { }, } } + + // If the updates succeeded and we were in an already closed channel state, then there's no + // need to refuse any updates we expect to receive afer seeing a confirmed commitment. + if ret.is_ok() && updates.update_id == CLOSED_CHANNEL_UPDATE_ID && self.latest_update_id == updates.update_id { + return Ok(()); + } + self.latest_update_id = updates.update_id; if ret.is_ok() && self.funding_spend_seen {