From 47c8aa51a666b48f2a414f545a06e0f92935a139 Mon Sep 17 00:00:00 2001 From: Arik Sosman Date: Wed, 28 Aug 2024 09:33:14 -0700 Subject: [PATCH] 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. --- lightning/src/util/persist.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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( -- 2.39.5