Skip to content
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

Periodically archive fully resolved channel monitors #307

Merged

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Jun 11, 2024

Fixes #300.

Previously, LDK was very conservative and kept channel monitors around ~forever or until the user manually decided to prune them. Recently it introduced the ChainMonitor::archive_fully_resolved_monitors method, which we now call periodically: every time a wallet sync succeeds, we check whether the latest archival height is 6 blocks in the past and
call archive_fully_resolved_monitors.

As this is not permanently persisted, we will always try to archive any pruned monitors when the first background sync after fresh initialization succeeds, ensuring we call it regularly also on
short-lived sessions, e.g, on mobile.

In the second and third commit, we fix previous omissions of sync_wallets: we now update the timestamps read by NodeStatus and also have it update the fee rate cache.

@tnull tnull requested a review from G8XSU June 11, 2024 09:41
@tnull tnull added this to the 0.3 milestone Jun 11, 2024
@tnull tnull force-pushed the 2024-06-archive-fully-resolved-monitors branch 2 times, most recently from e04aaa8 to 2daeb98 Compare June 11, 2024 10:35
src/config.rs Outdated Show resolved Hide resolved
@tnull tnull force-pushed the 2024-06-archive-fully-resolved-monitors branch 3 times, most recently from a81cff5 to 27623e0 Compare June 11, 2024 11:04
Previously, LDK was very conservative and kept channel monitors around
~forever or until the user manually decided to prune them. Recently it
introduced the `ChainMonitor::archive_fully_resolved_monitors` method,
which we now call periodically: every time a wallet sync succeeds, we
check whether the latest archival height is 6 blocks in the past and
call `archive_fully_resolved_monitors`.

As this is not permanently persisted, we will always try to archive any
pruned monitors when the first background sync after fresh
initialization succeeds, ensuring we call it regularly also on
short-lived sessions, e.g, on mobile.
.. which we previously omitted.
@tnull tnull force-pushed the 2024-06-archive-fully-resolved-monitors branch from 27623e0 to accd3c8 Compare June 11, 2024 18:55
@tnull
Copy link
Collaborator Author

tnull commented Jun 11, 2024

Rebased to resolve minor conflict after #141 landed.

src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@G8XSU
Copy link
Contributor

G8XSU commented Jun 13, 2024

Lgtm!,
fix for making archive work in mobile can land independently and will make it to ldk-node when ldk is upgraded later.

@tnull tnull merged commit 3a328d4 into lightningdevkit:main Jun 14, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Archive old ChannelMonitors
3 participants