-
Notifications
You must be signed in to change notification settings - Fork 404
Force-close channels on reorg only if the funding is unconfirmed #1461
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
Force-close channels on reorg only if the funding is unconfirmed #1461
Conversation
Currently, if a channel's funding is locked in and then later reorg'd back to half of the channel's minimum-depth we will immediately force-close the channel. However, this can happen at the fork-point while processing a reorg, and generally reorgs do not reduce the block height at all, making this a rather useless endeavor. Ideally we'd never auto-force-close channels at all due to a reorg, instead simply marking it as inactive until the funding transaction is re-confirmed (or allowing the user to attempt to force-close or force-closing once we're confident we have completed reorg processing if we're at risk of losing funds already received in the channel). Sadly, we currently do not support changing a channel's SCID and updating our SCID maps, so we cannot yet remove the automated force-close logic. Still, there is no reason to do it until a funding transaction has been removed from the chain. This implements that change - only force-closeing once a channel's funding transaction has been reorg'd out (still potentially at a reorg's fork point). This continues to imply a 1-confirmation channel will always be force-closed after a reorg of the funding transaction, and will imply a similar behavior with 0-conf channels.
Codecov Report
@@ Coverage Diff @@
## main #1461 +/- ##
==========================================
+ Coverage 90.90% 91.13% +0.23%
==========================================
Files 75 75
Lines 41616 43390 +1774
Branches 41616 43390 +1774
==========================================
+ Hits 37829 39544 +1715
- Misses 3787 3846 +59
Continue to review full report at Codecov.
|
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, maybe can be a good introduce atest to cover this edge case?
61f097e
to
6e5169b
Compare
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
3030dba
Actually, partially unded that last commit - if we're doing |
3030dba
to
1568097
Compare
Squashed the last fixup commit |
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.
cr-ACK 1568097
Currently, if a channel's funding is locked in and then later
reorg'd back to half of the channel's minimum-depth we will
immediately force-close the channel. However, this can happen at
the fork-point while processing a reorg, and generally reorgs do
not reduce the block height at all, making this a rather useless
endeavor.
Ideally we'd never auto-force-close channels at all due to a reorg,
instead simply marking it as inactive until the funding
transaction is re-confirmed (or allowing the user to attempt to
force-close or force-closing once we're confident we have
completed reorg processing if we're at risk of losing funds
already received in the channel).
Sadly, we currently do not support changing a channel's SCID and
updating our SCID maps, so we cannot yet remove the automated
force-close logic. Still, there is no reason to do it until a
funding transaction has been removed from the chain.
This implements that change - only force-closeing once a channel's
funding transaction has been reorg'd out (still potentially at a
reorg's fork point). This continues to imply a 1-confirmation
channel will always be force-closed after a reorg of the funding
transaction, and will imply a similar behavior with 0-conf
channels.