Add InvoicePayer for retrying failed payments
authorJeffrey Czyz <jkczyz@gmail.com>
Tue, 24 Aug 2021 05:08:15 +0000 (00:08 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Wed, 27 Oct 2021 15:54:39 +0000 (10:54 -0500)
commitad4f16b3e60bbc074423639fe5cfdb9f7174e1e9
tree1709c50197f5a423522fccf8084188aa4ab353c8
parent2d102a3065d7a438d5c88fffcad36545a0822bfa
Add InvoicePayer for retrying failed payments

When a payment fails, it's useful to retry the payment once the network
graph and channel scores are updated. InvoicePayer is a utility for
making payments which will retry any failed payment paths for a payment
up to a configured number of total attempts. It is parameterized by a
Payer and Router for ease of customization and testing.

Implement EventHandler for InvoicePayer as a decorator that intercepts
PaymentPathFailed events and retries that payment using the parameters
from the event. It delegates to the decorated EventHandler after retries
have been exhausted and for other events.
lightning-invoice/src/lib.rs
lightning-invoice/src/payment.rs [new file with mode: 0644]
lightning/src/util/events.rs