From: Arik Sosman Date: Wed, 28 Aug 2024 16:33:14 +0000 (-0700) Subject: Process updates before archiving monitors. X-Git-Tag: v0.0.124-rc1~5^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=47c8aa51a666b48f2a414f545a06e0f92935a139;p=rust-lightning Process updates before archiving monitors. Previously, `MonitorUpdatingPersister` was disregarding any unapplied monitor updates when archiving them. This commit ensures that upon reading monitors, their corresponding updates are also read and applied prior to archiving. --- diff --git a/lightning/src/util/persist.rs b/lightning/src/util/persist.rs index a845cc178..64fe84a09 100644 --- a/lightning/src/util/persist.rs +++ b/lightning/src/util/persist.rs @@ -762,7 +762,8 @@ where fn archive_persisted_channel(&self, funding_txo: OutPoint) { let monitor_name = MonitorName::from(funding_txo); - let monitor = match self.read_monitor(&monitor_name) { + let monitor_key = monitor_name.as_str().to_string(); + let monitor = match self.read_channel_monitor_with_updates(monitor_key) { Ok((_block_hash, monitor)) => monitor, Err(_) => return }; @@ -770,9 +771,9 @@ where ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE, ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE, monitor_name.as_str(), - &monitor.encode() + &monitor.encode(), ) { - Ok(()) => {}, + Ok(()) => {} Err(_e) => return, }; let _ = self.kv_store.remove(