-
Notifications
You must be signed in to change notification settings - Fork 418
Process updates before archiving monitors. #3276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -762,17 +762,18 @@ 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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pre-existing, but I think the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Separately, there's also the issue of applying monitor updates requiring a fee estimator and a broadcaster in the first place, which should be avoidable. I'll create issues for both. |
||
Err(_) => return | ||
}; | ||
match self.kv_store.write( | ||
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( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I'm not sure this bug is reachable at the moment because I think LDK will persist the full monitor on each block connection, and we don't archive until ~4k blocks have passed post-channel close. Still seems like a reasonable fix though in case things change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that caveat is addressed in the issue this is fixing. I think it primarily affects mobile clients.