use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret};
use lightning::ln::channelmanager::{ChannelDetails, PaymentId, PaymentSendFailure};
use lightning::ln::msgs::LightningError;
-use lightning::routing::scoring::{LockableScore, Score};
+use lightning::routing::scoring::{LockableScore, MultiThreadedLockableScore, Score};
use lightning::routing::router::{PaymentParameters, Route, RouteParameters};
use lightning::util::events::{Event, EventHandler};
use lightning::util::logger::Logger;
/// See [module-level documentation] for details.
///
/// [module-level documentation]: crate::payment
-pub struct InvoicePayer<P: Deref, R, S: Deref, L: Deref, E: EventHandler>
+pub struct InvoicePayer<P: Deref, S: Score, R: Deref, SR: Deref<Target = MultiThreadedLockableScore<S>>, L: Deref, E: EventHandler>
where
P::Target: Payer,
- R: for <'a> Router<<<S as Deref>::Target as LockableScore<'a>>::Locked>,
- S::Target: for <'a> LockableScore<'a>,
+ R::Target: Router<S>,
L::Target: Logger,
{
payer: P,
router: R,
- scorer: S,
+ scorer: SR,
logger: L,
event_handler: E,
/// Caches the overall attempts at making a payment, which is updated prior to retrying.
Sending(PaymentSendFailure),
}
-impl<P: Deref, R, S: Deref, L: Deref, E: EventHandler> InvoicePayer<P, R, S, L, E>
+impl<P: Deref, S: Score, R: Deref, SR: Deref<Target = MultiThreadedLockableScore<S>>, L: Deref, E: EventHandler> InvoicePayer<P, S, R, SR, L, E>
where
P::Target: Payer,
- R: for <'a> Router<<<S as Deref>::Target as LockableScore<'a>>::Locked>,
- S::Target: for <'a> LockableScore<'a>,
+ R::Target: Router<S>,
L::Target: Logger,
{
/// Creates an invoice payer that retries failed payment paths.
/// Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
/// `retry_attempts` has been exceeded for a given [`Invoice`].
pub fn new(
- payer: P, router: R, scorer: S, logger: L, event_handler: E, retry_attempts: RetryAttempts
+ payer: P, router: R, scorer: SR, logger: L, event_handler: E, retry_attempts: RetryAttempts
) -> Self {
Self {
payer,
} else { false }
}
-impl<P: Deref, R, S: Deref, L: Deref, E: EventHandler> EventHandler for InvoicePayer<P, R, S, L, E>
+impl<P: Deref, S: Score, R: Deref, SR: Deref<Target = MultiThreadedLockableScore<S>>, L: Deref, E: EventHandler> EventHandler for InvoicePayer<P, S, R, SR, L, E>
where
P::Target: Payer,
- R: for <'a> Router<<<S as Deref>::Target as LockableScore<'a>>::Locked>,
- S::Target: for <'a> LockableScore<'a>,
+ R::Target: Router<S>,
L::Target: Logger,
{
fn handle_event(&self, event: &Event) {