Fix missing PaymentSent::fee_paid_msat#4651
Conversation
If an outbound payment was abandoned with htlcs in-flight and later claimed, we would previously have the PaymentSent::fee_paid_msat be set to None. This contradicted some docs on the event that stated the field would always be Some after 0.0.103.
|
I've assigned @tankyleo as a reviewer! |
| /// overstate the amount paid, though this is unlikely. | ||
| /// | ||
| /// This is only `None` for payments initiated on LDK versions prior to 0.0.103. | ||
| /// May be `None` for payments initiated on LDK versions prior to 0.4. |
There was a problem hiding this comment.
nit: This wording slightly overstates the scope. For payments that stayed in Retryable state (i.e., were never abandoned while in-flight), fee_paid_msat has been Some since 0.0.103. The None gap between 0.0.103 and 0.4 only applies to payments that were abandoned with HTLCs in-flight and then unexpectedly claimed.
Something like "May be None for payments abandoned on LDK versions prior to 0.4, or initiated prior to 0.0.103." would be more precise. Not blocking — the current "May be" phrasing is technically correct.
There was a problem hiding this comment.
I like keeping it simple but open to feedback
Review SummaryThe fix is correct. The core logic — preserving
The test assertion change from Inline comments posted:
No bugs found. |
|
Fuzz failure looks pre-existing, seems to error with "Expected disconnect" |
|
🔔 1st Reminder Hey @tankyleo! This PR has been waiting for your review. |
| if let Some(max_total_routing_fee_msat) = remaining_max_total_routing_fee_msat.as_mut() { | ||
| *max_total_routing_fee_msat = max_total_routing_fee_msat.saturating_add(path_fee_msat); | ||
| } | ||
| } else if let PendingOutboundPayment::Abandoned { pending_fee_msat, .. } = self { |
There was a problem hiding this comment.
In this block should we also subtract path.final_value_msat() from total_msat so that PaymentSent reports the amount that was actually sent ?
| @@ -318,6 +324,7 @@ impl PendingOutboundPayment { | |||
| payment_hash: *payment_hash, | |||
| reason: Some(reason), | |||
| total_msat, | |||
There was a problem hiding this comment.
curious here if we should be setting this to the sum of the current paths currently in-flight, and not the fixed total msat ?
If an outbound payment was abandoned with htlcs in-flight and later claimed, we would previously have the
PaymentSent::fee_paid_msatbe set toNone. This contradicted some docs on the event that stated the field would always beSomeafter 0.0.103.Fixes #4639