-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
backups: Keep channel backup in case of local force close #5528
backups: Keep channel backup in case of local force close #5528
Conversation
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.
LGTM 📽
// by Carol since it was already force closed before we started the | ||
// recovery. All we need is for Carol to send us over the commit height | ||
// so we can sweep the time locked output with the correct commit point. | ||
if testCase.localForceClose { |
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.
👍
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.
As you mentioned in the OP, in the future we could provide the brute force logic locally in the chain watcher if we detect this case.
f56bfb4
to
aa2706f
Compare
With the latest test run, looks like some other tests need to be updated for the extra even that gets emitted now (itests). |
We'll want to be informed about a channel that's been fully resolved on chain in case it was involved in a force close. We add a new event type and emit method for it.
We might want to react to a channel being fully resolved after being involved in a force close. For this we add a new callback and invoke it where appropriate.
In case we force close a channel from our end the funds can be time locked for up to 2 weeks worst case. If something happens to our node in that time, we don't have any information on that channel anymore because currently the channel is removed from the channel backup file the moment the commitment transaction confirms. Instead we want to keep the channel around in the SCB file until we've actually swept the time locked funds. It looks like lnd even supports recovering from such a case if the peer is still online and can tell us what commit height to use for deriving the commit point. If the peer isn't around anymore then external tools could be used to brute force the commit height.
This commit adds the new channel update event for a channel that is now fully resolved to the event subscription RPC.
With one more notification event being dispatched in the local force close case we need to update one of the integration tests to account for the additional message.
We want to make sure we can recover funds from a channel that was force closed by the local node just before the node needed to be restored. We add a special test case with specific assertions for that scenario.
aa2706f
to
dee28ee
Compare
Because we now get one more update per channel when closing it, we need to update our test that looks at the close notifications sent by the SubscribeChannelEvent RPC.
dee28ee
to
527c6f0
Compare
In case we force close a channel from our end the funds can be time
locked for up to 2 weeks worst case. If something happens to our node in
that time, we don't have any information on that channel anymore because
currently the channel is removed from the channel backup file the moment
the commitment transaction confirms.
Instead we want to keep the channel around in the SCB file until we've
actually swept the time locked funds.
It looks like lnd even supports recovering from such a case if the peer
is still online and can tell us what commit height to use for deriving
the commit point. If the peer isn't around anymore then external tools
could be used to brute force the commit height.
Thanks to @joostjager for making me aware this problem existed.