-//! A module for paying Lightning invoices and sending spontaneous payments.
-//!
-//! Defines an [`InvoicePayer`] utility for sending payments, parameterized by [`Payer`] and
-//! [`Router`] traits. Implementations of [`Payer`] provide the payer's node id, channels, and means
-//! to send a payment over a [`Route`]. Implementations of [`Router`] find a [`Route`] between payer
-//! and payee using information provided by the payer and from the payee's [`Invoice`], when
-//! applicable.
-//!
-//! [`InvoicePayer`] is parameterized by a [`LockableScore`], which it uses for scoring failed and
-//! successful payment paths upon receiving [`Event::PaymentPathFailed`] and
-//! [`Event::PaymentPathSuccessful`] events, respectively.
-//!
-//! [`InvoicePayer`] is capable of retrying failed payments. It accomplishes this by implementing
-//! [`EventHandler`] which decorates a user-provided handler. It will intercept any
-//! [`Event::PaymentPathFailed`] events and retry the failed paths for a fixed number of total
-//! attempts or until retry is no longer possible. In such a situation, [`InvoicePayer`] will pass
-//! along the events to the user-provided handler.
-//!
-//! # Example
-//!
-//! ```
-//! # extern crate lightning;
-//! # extern crate lightning_invoice;
-//! # extern crate secp256k1;
-//! #
-//! # use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret};
-//! # use lightning::ln::channelmanager::{ChannelDetails, PaymentId, PaymentSendFailure};
-//! # use lightning::ln::msgs::LightningError;
-//! # use lightning::routing::scoring::Score;
-//! # use lightning::routing::network_graph::NodeId;
-//! # use lightning::routing::router::{Route, RouteHop, RouteParameters};
-//! # use lightning::util::events::{Event, EventHandler, EventsProvider};
-//! # use lightning::util::logger::{Logger, Record};
-//! # use lightning::util::ser::{Writeable, Writer};
-//! # use lightning_invoice::Invoice;
-//! # use lightning_invoice::payment::{InvoicePayer, Payer, RetryAttempts, Router};
-//! # use secp256k1::key::PublicKey;
-//! # use std::cell::RefCell;
-//! # use std::ops::Deref;
-//! #
-//! # struct FakeEventProvider {}
-//! # impl EventsProvider for FakeEventProvider {
-//! # fn process_pending_events<H: Deref>(&self, handler: H) where H::Target: EventHandler {}
-//! # }
-//! #
-//! # struct FakePayer {}
-//! # impl Payer for FakePayer {
-//! # fn node_id(&self) -> PublicKey { unimplemented!() }
-//! # fn first_hops(&self) -> Vec<ChannelDetails> { unimplemented!() }
-//! # fn send_payment(
-//! # &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret>
-//! # ) -> Result<PaymentId, PaymentSendFailure> { unimplemented!() }
-//! # fn send_spontaneous_payment(
-//! # &self, route: &Route, payment_preimage: PaymentPreimage
-//! # ) -> Result<PaymentId, PaymentSendFailure> { unimplemented!() }
-//! # fn retry_payment(
-//! # &self, route: &Route, payment_id: PaymentId
-//! # ) -> Result<(), PaymentSendFailure> { unimplemented!() }
-//! # fn abandon_payment(&self, payment_id: PaymentId) { unimplemented!() }
-//! # }
-//! #
-//! # struct FakeRouter {}
-//! # impl<S: Score> Router<S> for FakeRouter {
-//! # fn find_route(
-//! # &self, payer: &PublicKey, params: &RouteParameters, payment_hash: &PaymentHash,
-//! # first_hops: Option<&[&ChannelDetails]>, scorer: &S
-//! # ) -> Result<Route, LightningError> { unimplemented!() }
-//! # }
-//! #
-//! # struct FakeScorer {}
-//! # impl Writeable for FakeScorer {
-//! # fn write<W: Writer>(&self, w: &mut W) -> Result<(), std::io::Error> { unimplemented!(); }
-//! # }
-//! # impl Score for FakeScorer {
-//! # fn channel_penalty_msat(
-//! # &self, _short_channel_id: u64, _send_amt: u64, _chan_amt: Option<u64>, _source: &NodeId, _target: &NodeId
-//! # ) -> u64 { 0 }
-//! # fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
-//! # fn payment_path_successful(&mut self, _path: &[&RouteHop]) {}
-//! # }
-//! #
-//! # struct FakeLogger {}
-//! # impl Logger for FakeLogger {
-//! # fn log(&self, record: &Record) { unimplemented!() }
-//! # }
-//! #
-//! # fn main() {
-//! let event_handler = |event: &Event| {
-//! match event {
-//! Event::PaymentPathFailed { .. } => println!(\"payment failed after retries\"),
-//! Event::PaymentSent { .. } => println!(\"payment successful\"),
-//! _ => {},
-//! }
-//! };
-//! # let payer = FakePayer {};
-//! # let router = FakeRouter {};
-//! # let scorer = RefCell::new(FakeScorer {});
-//! # let logger = FakeLogger {};
-//! let invoice_payer = InvoicePayer::new(&payer, router, &scorer, &logger, event_handler, RetryAttempts(2));
-//!
-//! let invoice = \"...\";
-//! if let Ok(invoice) = invoice.parse::<Invoice>() {
-//! invoice_payer.pay_invoice(&invoice).unwrap();
-//!
-//! # let event_provider = FakeEventProvider {};
-//! loop {
-//! event_provider.process_pending_events(&invoice_payer);
-//! }
-//! }
-//! # }
-//! ```
-//!
-//! # Note
-//!
-//! The [`Route`] is computed before each payment attempt. Any updates affecting path finding such
-//! as updates to the network graph or changes to channel scores should be applied prior to
-//! retries, typically by way of composing [`EventHandler`]s accordingly.