Skip to content

Commit 7c07d5c

Browse files
committed
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 caches the payment Invoice so that it can be used when retrying the payment. It is parameterized by a Payer and Router for ease of customization and testing. Implement EventHandler for InvoicePayer as a decorator that intercepts PaymentFailed events and retries that payment using the cached Invoice. It delegates to the decorated EventHandler after retries have been exhausted and for other events.
1 parent ce662f0 commit 7c07d5c

File tree

4 files changed

+557
-1
lines changed

4 files changed

+557
-1
lines changed

lightning-invoice/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ bech32 = "0.8"
1313
lightning = { version = "0.0.100", path = "../lightning" }
1414
secp256k1 = { version = "0.20", features = ["recovery"] }
1515
num-traits = "0.2.8"
16+
bitcoin = "0.27"
1617
bitcoin_hashes = "0.10"
1718

1819
[dev-dependencies]

lightning-invoice/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
//! * For parsing use `str::parse::<Invoice>(&self)` (see the docs of `impl FromStr for Invoice`)
1616
//! * For constructing invoices use the `InvoiceBuilder`
1717
//! * For serializing invoices use the `Display`/`ToString` traits
18+
pub mod payment;
1819
pub mod utils;
1920

2021
extern crate bech32;
22+
extern crate bitcoin;
2123
extern crate bitcoin_hashes;
22-
extern crate lightning;
24+
#[macro_use] extern crate lightning;
2325
extern crate num_traits;
2426
extern crate secp256k1;
2527

0 commit comments

Comments
 (0)