Skip to content

Conversation

@wvanlint
Copy link
Contributor

@wvanlint wvanlint commented Aug 8, 2025

Currently, the anchor commitment bump events are bypassed when the commitment transaction has sufficient fees. However, this makes it difficult for users to defer force-closures to a trusted party (such as an LSP) while not maintaining reserves. Broadcasting a commitment transaction without maintaining reserves would make HTLCs unclaimable against that commitment transaction.

In this change, anchor commitment bump events will always be emitted so users can capture and choose not to process them.

Fixes #3496.

Currently, the anchor commitment bump events are bypassed when the
commitment transaction has sufficient fees. However, this makes it
difficult for users to defer force-closures to a trusted party (such as
an LSP) while not maintaining reserves. Broadcasting a commitment
transaction without maintaining reserves would make HTLCs unclaimable
against that commitment transaction.

In this change, anchor commitment bump events will always be emitted so
users can capture and choose not to process them.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Aug 8, 2025

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@wpaulino
Copy link
Contributor

wpaulino commented Aug 8, 2025

Basically LGTM, any reason why it's draft?

@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 83.95062% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.94%. Comparing base (192618b) to head (d99e59b).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/monitor_tests.rs 72.72% 3 Missing and 3 partials ⚠️
lightning/src/ln/reorg_tests.rs 84.61% 3 Missing and 1 partial ⚠️
lightning/src/ln/functional_test_utils.rs 85.71% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4001   +/-   ##
=======================================
  Coverage   88.93%   88.94%           
=======================================
  Files         174      174           
  Lines      124593   124642   +49     
  Branches   124593   124642   +49     
=======================================
+ Hits       110813   110861   +48     
- Misses      11283    11287    +4     
+ Partials     2497     2494    -3     
Flag Coverage Δ
fuzzing 22.17% <0.00%> (-0.01%) ⬇️
tests 88.77% <83.95%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@wvanlint wvanlint marked this pull request as ready for review August 9, 2025 00:20
@wvanlint
Copy link
Contributor Author

wvanlint commented Aug 9, 2025

Basically LGTM, any reason why it's draft?

Ah, I was mainly waiting for CI to complete successfully, marked ready for review now.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @joostjager! 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.

@tnull tnull requested review from wpaulino and removed request for joostjager August 11, 2025 07:51
@ldk-reviews-bot
Copy link

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

@wpaulino wpaulino requested a review from TheBlueMatt August 11, 2025 15:45
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! This actually seems like a bugfix. I was curious why the tests were changing at all, it looks like if we do the event-bypass we won't properly bump the commitment-broadcast feerate after every few blocks like we should, at least in some cases.

In update_claims_view_from_requests (and update_claims_view_from_matched_txn) we set_feerate on the package to the feerate returned by generate_claim. In the bypass code removed here, we return a selected feerate of 0, rather than the actually-used feerate (or the target feerate, which I think we should really be using). Then, if the feerate is 0, we'll consider it "no previous feerate" in the bump logic and just use the new fee estimator rather than bumping 25% if we don't see confirmation. This isn't that critical as we'll still increase fee if the fee estimator goes up, and in any case where the fee estimator goes up enough to jump beyond the by pass case we'll immediately start the regular 25%-ever-few-blocks bumping we want anyway, but it does make us rely on the user's fee estimator more than we want to.

@TheBlueMatt TheBlueMatt merged commit 3b939c0 into lightningdevkit:main Aug 11, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use bump events for broadcasting anchor commitment txn even if they have enough fees

4 participants