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

Stop relying on ChannelMonitor persistence after manager read

Open TheBlueMatt opened this issue 1 year ago • 4 comments

When we discover we've only partially claimed an MPP HTLC during ChannelManager reading, we need to add the payment preimage to all other ChannelMonitors that were a part of the payment.

We previously did this with a direct call on the ChannelMonitor, requiring users write the full ChannelMonitor to disk to ensure that updated information made it.

This adds quite a bit of delay during initial startup - fully resilvering each ChannelMonitor just to handle this one case is incredibly excessive.

Instead, we rewrite the MPP claim replay logic to use only (new) data included in ChannelMonitors, which has a nice side-effect of teeing up future ChannelManager-non-persistence features as well as makes our PaymentClaimed event generation much more robust.

TheBlueMatt avatar Sep 18 '24 01:09 TheBlueMatt

A bunch of tests are still trying to call provide_payment_preimage()

arik-so avatar Sep 24 '24 03:09 arik-so

Ugh, sorry, fixed. Also rebased and fixed an issue introduced in #3303

TheBlueMatt avatar Sep 30 '24 21:09 TheBlueMatt

Codecov Report

Attention: Patch coverage is 90.65657% with 37 lines in your changes missing coverage. Please review.

Project coverage is 89.66%. Comparing base (a661c92) to head (b0fa756).

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 89.36% 23 Missing and 9 partials :warning:
lightning/src/chain/channelmonitor.rs 96.00% 2 Missing :warning:
lightning/src/ln/reload_tests.rs 88.88% 0 Missing and 2 partials :warning:
lightning/src/ln/channel.rs 91.66% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3322      +/-   ##
==========================================
- Coverage   89.68%   89.66%   -0.02%     
==========================================
  Files         126      126              
  Lines      103168   103370     +202     
  Branches   103168   103370     +202     
==========================================
+ Hits        92522    92686     +164     
- Misses       7934     7971      +37     
- Partials     2712     2713       +1     
Flag Coverage Δ
89.66% <90.65%> (-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.

codecov[bot] avatar Sep 30 '24 21:09 codecov[bot]

Tagging 0.1 because of the first commit.

TheBlueMatt avatar Oct 01 '24 13:10 TheBlueMatt

Squashed fixups and rebased to tell clippy to shut up.

TheBlueMatt avatar Oct 23 '24 16:10 TheBlueMatt

LGTM after squash.

valentinewallace avatar Oct 24 '24 17:10 valentinewallace

Squashed without further changes.

TheBlueMatt avatar Oct 24 '24 17:10 TheBlueMatt