forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 2
hsmd: Add hsmd_forget_channel to tell hsmd to delete a channel #101
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
Draft
ksedgwic
wants to merge
3
commits into
2023-11-remote-hsmd-v23.11
Choose a base branch
from
2023-12-hsmd-forget-channel
base: 2023-11-remote-hsmd-v23.11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I do not know when but if the hsmd is telling us that we can not close the channel? it is better to leave the database untouch?
In other words do you think that it is better move this code on top of the https://github.com/lightning-signer/c-lightning/pull/101/files#diff-109e3febdfc51acb2389960ebf7af4fab4deaff873eb35e09a57b3efea5225f3R96 ?
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.
Thoughts:
forget_channel
calls happen 100 blocks after all future activity is not possible because the channel has been closed, swept, etc. It's not about "closing" the channel but rather promising that it will never be referred to again so it's ok to recover it's resources (for VLS recovering the memory is critical on small embedded devices (like the SphinxSigner, aka Stakwork))forget_channel
does almost nothing, it merely sets a flag on the channel that tells us that we saw the node announce that it had forgotten itSo there are two "bad" cases, both caused by only part of the routine above completing:
In case #1 we have a terrible outcome, CLN asks VLS to sign something related to the channel (the defensive rebroadcast of the "last tx, for example") but the channel is unknown to VLS. This what we saw on
home4
. VLS panics, no progress is made because CLN panics as well and restarts and then reissues the same operation again and again ...Case #2 is not so bad, CLN goes on having forgotten about the channel and VLS will warn "hey, I haven't see the expected
forget_channel
from CLN for this channel and keeps holding off. After 2016 blocks (roughly 2 weeks) VLS will give up and delete the channel. So some memory is not available for other channels in the meantime. But it heals in 2 weeks.So we vastly prefer the 2nd alternative which corresponds to CLN telling it forgot after it forgets for sure.
The operations takeaway is that if you see this warning persisting it is good to check on the channel status on the node side. If something on the CLN side is a little broken you can use the
--developer
lightning-cli dev-forget-channel id=0248691d3963b05a...
to clean it up.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.
Make sense, thanks to write it down