-
Notifications
You must be signed in to change notification settings - Fork 423
[Splicing] Add reserve check to splicing #3641
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
Conversation
|
👋 Hi! This PR is now in draft status. |
|
Relevant comments from #3407:
Relevant method: |
e34d33c to
6ec1a19
Compare
6ec1a19 to
8ac1467
Compare
|
Rebased, post #3407 . |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3641 +/- ##
==========================================
- Coverage 88.94% 88.93% -0.02%
==========================================
Files 174 174
Lines 124200 124539 +339
Branches 124200 124539 +339
==========================================
+ Hits 110471 110760 +289
- Misses 11253 11283 +30
- Partials 2476 2496 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8ac1467 to
b073d8c
Compare
|
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
b073d8c to
f406c53
Compare
|
Fixes done:
|
lightning/src/ln/channel.rs
Outdated
| return Err(post_channel_reserve_sats); | ||
| } | ||
| } else { | ||
| if pre_balance >= self.funding.holder_selected_channel_reserve_satoshis * 1000 { |
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.
We also need to check if the channel has never been spliced before to use the v1 reserve
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'm not sure how to do that, I suppose is_v2_established() does not change. @wpaulino
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.
If self.funding.splice_parent_funding_txid is not set and the channel ID is the same as the funding outpoint, then we use the v1 reserve
lightning/src/ln/channel.rs
Outdated
| /// Pending HTLCs are not taken into account, this method should be used when there is no such, | ||
| /// e.g. in quiscence state | ||
| #[cfg(splicing)] | ||
| fn compute_balances_less_fees(&self, channel_value_sats: u64, value_to_self_msat: u64, is_local: bool) -> (u64, u64) { |
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.
@tankyleo is going to split up the existing build_commitment_transaction method into two, so that we can get the balances without building the commitment transaction. Once that lands, we can use it here in favor of this to avoid the code duplication.
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.
See build_commitment_stats
47f4737 to
eb1fc46
Compare
793e8b7 to
a0fe395
Compare
d4a0ffa to
c69a2cb
Compare
c78211b to
858ded0
Compare
|
Rebased to recent main (post- #3736 ), more cleanup needed. |
951f14d to
3aab4a1
Compare
3aab4a1 to
b2d874c
Compare
|
This work was taken as a part of splicing landing in 0.2. 🎉 |
This is a continuation of #3407, adds proper channel balance/reserve check, when handling
splice_ack(on initiator side).