Use only the failed amount when retrying payments, not the full amt
authorMatt Corallo <git@bluematt.me>
Sat, 28 Jan 2023 02:14:26 +0000 (02:14 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 1 Feb 2023 21:16:18 +0000 (21:16 +0000)
commit071297234ac3490bcbdc30caa7f6768ecea9eca7
tree5fd3ef88943da48ab0fe41e56eaf776826f665e1
parent8af05e0172ab8176d1abe139521fda9d6efbed9a
Use only the failed amount when retrying payments, not the full amt

When we landed the initial in-`ChannelManager` payment retries, we
stored the `RouteParameters` in the payment info, and then re-use
it as-is for new payments. `RouteParameters` is intended to store
the information specific to the *route*, `PaymentParameters` exists
to store information specific to a payment.

Worse, because we don't recalculate the amount stored in the
`RouteParameters` before fetching a new route with it, we end up
attempting to retry the full payment amount, rather than only the
failed part.

This issue brought to you by having redundant data in
datastructures, part 5,001.
lightning/src/ln/channelmanager.rs
lightning/src/ln/outbound_payment.rs
lightning/src/ln/payment_tests.rs