-
Notifications
You must be signed in to change notification settings - Fork 409
Expose a Balance
for inbound HTLCs even without a preimage
#1673
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
Expose a Balance
for inbound HTLCs even without a preimage
#1673
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.
Looks good, test_claim_value_force_close
just needs to be updated to handle the new variant.
57f4228
to
190e6be
Compare
Fixed the failing test and rebased after #1495 landed. |
190e6be
to
c6440b1
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.
The new variant LGTM, I'm just not following the test 100% right now. Will give it another run-through later.
Just left a few nits.
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!
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.
Went through the test, LGTM besides the rename idea and a nit
Codecov Report
@@ Coverage Diff @@
## main #1673 +/- ##
==========================================
+ Coverage 90.77% 90.90% +0.13%
==========================================
Files 80 85 +5
Lines 44763 45888 +1125
Branches 44763 45888 +1125
==========================================
+ Hits 40632 41715 +1083
- Misses 4131 4173 +42
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
ACK after squash
@@ -1565,6 +1576,11 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> { | |||
timeout_height: htlc.cltv_expiry, | |||
}); | |||
} | |||
} else if htlc_resolved.is_none() { |
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.
Fwiw, tests pass when this is just else
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.
Ah, right, it'd be unreachable otherwise as we have a separate else clause for resolved.is_some && !spend_pending (and spend_pending would require that we have the preimage, which ends up in the previous clause). I'm still gonna leave it as-is if that's okay.
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.
Sg, it reads fine IMO
If we don't currently have the preimage for an inbound HTLC, that does not guarantee we can never claim it, but instead only that we cannot claim it unless we receive the preimage from the channel we forwarded the channel out on. Thus, we cannot consider a channel to have no claimable balances if the only remaining output on the commitment ransaction is an inbound HTLC for which we do not have the preimage, as we may be able to claim it in the future. This commit addresses this issue by adding a new `Balance` variant - `MaybePreimageClaimableHTLCAwaitingTimeout`, which is generated until the HTLC output is spent. Fixes lightningdevkit#1620
As we now have a MaybePreimageClaimableHTLC, its more consistent to rename `MaybeClaimableHTLCAwaitingTimeout` to `MaybeTimeoutClaimableHTLC`.
Squashed without further changes. |
c7e98b8
to
39cede6
Compare
Fixes #1620, based on #1495.