rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

[Splicing] Add reserve check to splicing

Open optout21 opened this issue 10 months ago • 9 comments

This is a continuation of #3407, adds proper channel balance/reserve check, when handling splice_ack (on initiator side).

optout21 avatar Mar 04 '25 11:03 optout21

👋 Hi! This PR is now in draft status. I'll wait to assign reviewers until you mark it as ready for review. Just convert it out of draft status when you're ready for review!

ldk-reviews-bot avatar Mar 04 '25 11:03 ldk-reviews-bot

Relevant comments from #3407:

  • [X] value_to_self_msat doesn't include fees and anchor outputs value, to be considered similar to how it's done in build_commitment_transaction https://github.com/lightningdevkit/rust-lightning/pull/3407#discussion_r1970725164

  • [ ] https://github.com/lightningdevkit/rust-lightning/pull/3407#discussion_r1970522088

  • [X] https://github.com/lightningdevkit/rust-lightning/pull/3407#discussion_r1972029584

Relevant method: check_splice_balances_meet_v2_reserve_requirements

optout21 avatar Mar 04 '25 12:03 optout21

Suggestions implemented; for reserve requirement check, the balance is adjusted with fees and eventual anchor output value (see 6ec1a190bdf3a0dae19964f7b9c9e971434c294c). On hold, waiting for #3407 to land first.

optout21 avatar Mar 04 '25 19:03 optout21

Rebased, post #3407 .

optout21 avatar Mar 08 '25 07:03 optout21

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 88.93%. Comparing base (1e1d300) to head (b2d874c). :warning: Report is 753 commits behind head on main.

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     
Flag Coverage Δ
fuzzing 22.18% <40.00%> (-0.46%) :arrow_down:
tests 88.76% <100.00%> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Mar 08 '25 07:03 codecov[bot]

👋 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.

ldk-reviews-bot avatar Mar 11 '25 18:03 ldk-reviews-bot

Fixes done:

  • Fix Pre&Post reserve check
  • Assert that there are no pending HTLCs
  • Move splice reserve checks to FundedChannel, because few other fields are needed (is_v2, reserves from funding)
  • Fix Msat-Sat discrepancy in balance/reserve check, which I just noticed
  • Handle originally-v1 channel pre-splice reserve specially.

optout21 avatar Mar 20 '25 09:03 optout21

🔔 1st Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

ldk-reviews-bot avatar Mar 22 '25 09:03 ldk-reviews-bot

🔔 2nd Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

ldk-reviews-bot avatar Mar 24 '25 09:03 ldk-reviews-bot

Rebased to refresh

optout21 avatar Jun 25 '25 18:06 optout21

Rebased to recent main (post- #3736 ), more cleanup needed.

optout21 avatar Aug 04 '25 11:08 optout21

This work was taken as a part of splicing landing in 0.2. 🎉

TheBlueMatt avatar Nov 13 '25 20:11 TheBlueMatt