Skip to content

Commit 15a88d6

Browse files
committed
Add InvoicePayer and PaymentRetryHandler
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. PaymentRetryHandler is used in connection with InvoicePayer. It is an EventHandler decorator that intercepts PaymentFailed events and retries that payment using the cached Invoice.
1 parent c83a263 commit 15a88d6

File tree

3 files changed

+574
-1
lines changed

3 files changed

+574
-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.99", 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)