Add a variant to `PendingOutboundPayment` for retries-exceeded
authorMatt Corallo <git@bluematt.me>
Fri, 3 Dec 2021 19:57:37 +0000 (19:57 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 15 Dec 2021 03:57:13 +0000 (03:57 +0000)
commit0b3240ee6a6e1baeafaed9e766997098be588358
treea2338d90f6c6b2c7889116e696c2923e6dde3847
parent8c9615e8d6be6d4e3ff2d861a8a30266217672b2
Add a variant to `PendingOutboundPayment` for retries-exceeded

When a payer gives up trying to retry a payment, they don't know
for sure what the current state of the event queue is.
Specifically, they cannot be sure that there are not multiple
additional `PaymentPathFailed` or even `PaymentSuccess` events
pending which they will see later. Thus, they have a very hard
time identifying whether a payment has truly failed (and informing
the UI of that fact) or if it is still pending. See [1] for more
information.

In order to avoid this mess, we will resolve it here by having the
payer give `ChannelManager` a bit more information - when they
have given up on a payment - and using that to generate a
`PaymentFailed` event when all paths have failed.

This commit adds the neccessary storage and changes for the new
state inside `ChannelManager` and a public method to mark a payment
as failed, the next few commits will add the new `Event` and use
the new features in our `PaymentRetrier`.

[1] https://github.com/lightningdevkit/rust-lightning/issues/1164
lightning/src/ln/channelmanager.rs