Skip to content

Commit 82f1ae7

Browse files
committed
f - Update MPP completion condition in timeout check to match + leave comments
1 parent 5c71a1e commit 82f1ae7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3338,6 +3338,8 @@ where
33383338
_ => unreachable!(),
33393339
}
33403340
}
3341+
// The condition determining whether an MPP is complete must
3342+
// match exactly the condition used in `timer_tick_occurred`
33413343
if total_value >= msgs::MAX_VALUE_MSAT {
33423344
fail_htlc!(claimable_htlc, payment_hash);
33433345
} else if total_value - claimable_htlc.sender_intended_value >= $payment_data.total_msat {
@@ -3672,7 +3674,9 @@ where
36723674
if let OnionPayload::Invoice { .. } = htlcs[0].onion_payload {
36733675
// Check if we've received all the parts we need for an MPP (the value of the parts adds to total_msat).
36743676
// In this case we're not going to handle any timeouts of the parts here.
3675-
if htlcs[0].total_msat <= htlcs.iter().fold(0, |total, htlc| total + htlc.value) {
3677+
// This condition determining whether the MPP is complete here must match
3678+
// exactly the condition used in `process_pending_htlc_forwards`.
3679+
if htlcs[0].total_msat <= htlcs.iter().fold(0, |total, htlc| total + htlc.sender_intended_value) {
36763680
return true;
36773681
} else if htlcs.into_iter().any(|htlc| {
36783682
htlc.timer_ticks += 1;

0 commit comments

Comments
 (0)