-
Notifications
You must be signed in to change notification settings - Fork 366
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
Use correct input sequence for HTLC claims from counterparty commitments #2606
Use correct input sequence for HTLC claims from counterparty commitments #2606
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2606 +/- ##
==========================================
+ Coverage 88.84% 88.91% +0.07%
==========================================
Files 113 113
Lines 84729 85938 +1209
Branches 84729 85938 +1209
==========================================
+ Hits 75275 76412 +1137
- Misses 7240 7282 +42
- Partials 2214 2244 +30
☔ View full report in Codecov by Sentry. |
HTLC outputs, like the `to_remote` output, in commitment transactions with anchor outputs also have an additional `1 CSV` constraint on the counterparty. When spending such outputs, their corresponding input needs to have their sequence set to 1. This was done for HTLC claims from holder commitments, but unfortunately not for counterparty commitments as we were lacking test coverage.
d3bc90d
to
3c83783
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.
Tested ACK 3c83783 by mutating new Sequence::from_consensus(1)
tweaks in as_tx_input
and see test_yield_anchors_events
extensions fails accordingly.
See question if we’re missing test coverage or not on one path.
Sequence::ENABLE_RBF_NO_LOCKTIME | ||
}, | ||
_ => { | ||
debug_assert!(false, "This should not be reachable by 'untractable' or 'malleable with external funding' packages"); |
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.
Note to reviewer: in this context “malleable with external funding package” scope second-stage HTLC-timeout and HTLC-preimage claiming offered / received outputs on holder commitment transaction.
fn as_tx_input(&self, previous_output: BitcoinOutPoint) -> TxIn { | ||
let sequence = match self { | ||
PackageSolvingData::RevokedOutput(_) => Sequence::ENABLE_RBF_NO_LOCKTIME, | ||
PackageSolvingData::RevokedHTLCOutput(_) => Sequence::ENABLE_RBF_NO_LOCKTIME, |
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 think we’re testing the “anchor channel”-enabled revoked counterparty commitment offered HTLC outputs case in test_anchors_aggregated_revoked_htlc_tx
though I’m unsure we’re testing the claim with justice transaction on revoked counterparty commitment received HTLC ? All routed payments L2029 are in the same direction.
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 think it's covered now in #2610.
HTLC outputs, like the
to_remote
output, in commitment transactions with anchor outputs also have an additional1 CSV
constraint on the counterparty. When spending such outputs, their corresponding input needs to have their sequence set to 1. This was done for HTLC claims from holder commitments, but unfortunately not for counterparty commitments as we were lacking test coverage.