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

Persist ChannelMonitor after first setting balances_empty_height in archive_fully_resolved_channel_monitors #3121

Open
tnull opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels
Take a Friday Leave a Friday Stomp the Bugs, Without Much Commitment
Milestone

Comments

@tnull
Copy link
Contributor

tnull commented Jun 13, 2024

In lightningdevkit/ldk-node#307 (comment) @G8XSU observed that our current implementation of ChainMonitor::archive_fully_resolved_channel_monitors isn't necessarily suited for mobile use as we currently don't trigger persist after initially setting balances_empty_height in ChannelMonitor:

inner.balances_empty_height = Some(current_height);

This means that it will be lost upon restart if we don't happen to re-persist it for some extraneous reasons, which will likely be the case on mobile where we may be killed as soon as users quit the app. As we furthermore currently try to reduce/remove the number of arbitrary/superfluous persists in general (and hence hopefully might end up in a place where a fully-resolved monitor is ~never re-persisted anymore), going forward this might even be the case for any application that restarts before archive_fully_resolved_channel_monitors is called again after the four-week BLOCKS_THRESHOLD is reached.

When balances_empty_height is lost, we'll restart the BLOCKS_THRESHOLD, which likely means we'd never actually come around to archiving channel monitors on short-lived (four weeks isn't that short actually) instances such as mobile.

I think to mitigate this, we should simply trigger ChannelMonitor persistence once after we set balances_empty_height.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Take a Friday Leave a Friday Stomp the Bugs, Without Much Commitment
Projects
None yet
Development

No branches or pull requests

3 participants