Skip to content

Commit 47c8aa5

Browse files
committed
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.
1 parent 6119739 commit 47c8aa5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lightning/src/util/persist.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,17 +762,18 @@ where
762762

763763
fn archive_persisted_channel(&self, funding_txo: OutPoint) {
764764
let monitor_name = MonitorName::from(funding_txo);
765-
let monitor = match self.read_monitor(&monitor_name) {
765+
let monitor_key = monitor_name.as_str().to_string();
766+
let monitor = match self.read_channel_monitor_with_updates(monitor_key) {
766767
Ok((_block_hash, monitor)) => monitor,
767768
Err(_) => return
768769
};
769770
match self.kv_store.write(
770771
ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
771772
ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
772773
monitor_name.as_str(),
773-
&monitor.encode()
774+
&monitor.encode(),
774775
) {
775-
Ok(()) => {},
776+
Ok(()) => {}
776777
Err(_e) => return,
777778
};
778779
let _ = self.kv_store.remove(

0 commit comments

Comments
 (0)