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

Sweeper async change destination source fetching

Open joostjager opened this issue 9 months ago • 10 comments

This PR converts OutputSweeper to take an async ChangeDestinationSource implementation. This allows a (remote) address fetch call to run without blocking chain notifications.

Furthermore the changes demonstrates how LDK could be written in a natively async way, and still allow usage from a sync context using wrappers.

Part of #3540

joostjager avatar Apr 14 '25 11:04 joostjager

👋 Thanks for assigning @tnull 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.

ldk-reviews-bot avatar Apr 14 '25 11:04 ldk-reviews-bot

Codecov Report

Attention: Patch coverage is 81.65939% with 42 lines in your changes missing coverage. Please review.

Project coverage is 90.61%. Comparing base (f507778) to head (1a98158). Report is 68 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/util/sweep.rs 77.16% 25 Missing and 12 partials :warning:
lightning/src/util/async_poll.rs 57.14% 3 Missing :warning:
lightning-background-processor/src/lib.rs 96.22% 1 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3734      +/-   ##
==========================================
+ Coverage   89.13%   90.61%   +1.47%     
==========================================
  Files         157      157              
  Lines      123851   134826   +10975     
  Branches   123851   134826   +10975     
==========================================
+ Hits       110395   122170   +11775     
+ Misses      10779    10016     -763     
+ Partials     2677     2640      -37     

: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 Apr 21 '25 09:04 codecov[bot]

Basically LGTM, were there any major questions remaining you wanted resolved?

Few things:

  1. We are breaking the sweeper api in this PR. Are there specific things to check/double-check now? Update ldk-node perhaps to see if it works? Not sure if much more can be done, given that rust-lightning is an open-source library.

  2. The address inflation risk should have remained the same as before. We are calling sweeper on a timer now, but the filter function is still checking latest_broadcast_height. Or did I miss anything there?

  3. Futures flag: https://github.com/lightningdevkit/rust-lightning/pull/3734#discussion_r2052470771

joostjager avatar Apr 22 '25 06:04 joostjager

We are breaking the sweeper api in this PR. Are there specific things to check/double-check now? Update ldk-node perhaps to see if it works? Not sure if much more can be done, given that rust-lightning is an open-source library.

In general we don't care too much about API breaks between versions. Obviously we don't want to require downstream projects completely overhaul their integration with LDK just for the sake of it, but this change should basically just require adding "Sync" in a few places, so it should be trivial.

The address inflation risk should have remained the same as before. We are calling sweeper on a timer now, but the filter function is still checking latest_broadcast_height. Or did I miss anything there?

Sounds correct to me.

Futures flag: Sweeper async change destination source fetching #3734 (comment)

Indeed, I see no reason not to remove the futures feature from BP.

TheBlueMatt avatar Apr 22 '25 12:04 TheBlueMatt

🔔 1st Reminder

Hey @tnull! 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 Apr 23 '25 14:04 ldk-reviews-bot

Rebased after merge of #3509

joostjager avatar Apr 24 '25 14:04 joostjager

🔔 2nd Reminder

Hey @tnull! 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 Apr 26 '25 00:04 ldk-reviews-bot

🔔 3rd Reminder

Hey @tnull! 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 Apr 28 '25 00:04 ldk-reviews-bot

~Futures flag removed~

Changed my mind. Will do in a follow up.

joostjager avatar May 01 '25 10:05 joostjager

🔔 1st Reminder

Hey @tnull! 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 May 03 '25 12:05 ldk-reviews-bot

🔔 2nd Reminder

Hey @tnull! 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 May 05 '25 12:05 ldk-reviews-bot

🔔 3rd Reminder

Hey @tnull! 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 May 07 '25 12:05 ldk-reviews-bot

🔔 4th Reminder

Hey @tnull! 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 May 10 '25 00:05 ldk-reviews-bot

🔔 5th Reminder

Hey @tnull! 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 May 12 '25 00:05 ldk-reviews-bot

@TheBlueMatt addressed comments. Didn't do fixup commits, the github compare button shows the changes.

joostjager avatar May 13 '25 19:05 joostjager