Prefactor for Trampoline MPP accumulation#4510
Prefactor for Trampoline MPP accumulation#4510carlaKC wants to merge 12 commits intolightningdevkit:mainfrom
Conversation
|
👋 I see @valentinewallace was un-assigned. |
40f75a4 to
f15271e
Compare
|
I've completed a thorough review of every file and hunk in this PR diff, including reading source code for context around all major changes. I examined:
No issues found. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4510 +/- ##
========================================
Coverage 86.19% 86.19%
========================================
Files 160 160
Lines 107537 107713 +176
Branches 107537 107713 +176
========================================
+ Hits 92693 92848 +155
- Misses 12220 12238 +18
- Partials 2624 2627 +3
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:
|
|
🔔 1st Reminder Hey @valentinewallace! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @valentinewallace! This PR has been waiting for your review. |
|
Some discussion in the dependent PR, taking @valentinewallace off as a reviewer for now to save some bot-spam. |
Pull out all fields that are common to incoming claimable and trampoline MPP HTLCs. This will be used in future commits to accumulate MPP HTLCs that are part of trampoline forwards - we can't claim these, but need to accumulate them in the same way as receives before forwarding onwards.
We'll use this shared logic when we need to timeout trampoline HTLCs. Note that there's a slight behavior change in this commit. Previously, we'd do a first pass to check out total received value and return early if we'd reached it without applying a MPP tick to any HTLC. Now, we'll apply the MPP tick as we accumulate our total value received. This does not make any difference, because we never MPP-timeout fully accumulated MPP payments so it doesn't matter if we've applied the tick when we've reached our full amount.
We'll re-use this to check trampoline MPP timeout in future commits.
In the commit that follows we're going to need to take ownership of our htlc before this macro is used, so we pull out the information we need in advance.
We're going to use the same logic for trampoline and for incoming MPP payments, so we pull this out into a separate function.
To allow re-use with trampoline payments which won't use the ClaimablePayment type, make handling generic for anything with MPP parts.
For trampoline payments, we don't want to enforce a minimum cltv delta between our incoming and outer onion outgoing CLTV because we'll calculate our delta from the inner trampoline onion's value. However, we still want to check that we get at least the CLTV that the sending node intended for us and we still want to validate our incoming value. Refactor to allow setting a zero delta, for use for trampoline payments.
To use helper functions for either trampoline or regular paths.
To create trampoline forwarding and single hop receiving tails.
f15271e to
6aae0dd
Compare
This PR contains a set of refactors pulled out of #4493: