@@ -78,7 +78,7 @@ use core::time::Duration;
78
78
use core:: ops:: Deref ;
79
79
80
80
// Re-export this for use in the public API.
81
- pub use crate :: ln:: outbound_payment:: { PaymentSendFailure , Retry } ;
81
+ pub use crate :: ln:: outbound_payment:: { PaymentSendFailure , Retry , RetryableSendFailure } ;
82
82
83
83
// We hold various information about HTLC relay in the HTLC objects in Channel itself:
84
84
//
@@ -2437,7 +2437,7 @@ where
2437
2437
2438
2438
let per_peer_state = self . per_peer_state . read ( ) . unwrap ( ) ;
2439
2439
let peer_state_mutex = per_peer_state. get ( & counterparty_node_id)
2440
- . ok_or_else ( || APIError :: InvalidRoute { err : "No peer matching the path's first hop found!" } ) ?;
2440
+ . ok_or_else ( || APIError :: ChannelUnavailable { err : "No peer matching the path's first hop found!" . to_owned ( ) } ) ?;
2441
2441
let mut peer_state_lock = peer_state_mutex. lock ( ) . unwrap ( ) ;
2442
2442
let peer_state = & mut * peer_state_lock;
2443
2443
if let hash_map:: Entry :: Occupied ( mut chan) = peer_state. channel_by_id . entry ( id) {
@@ -2563,12 +2563,13 @@ where
2563
2563
2564
2564
/// Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
2565
2565
/// `route_params` and retry failed payment paths based on `retry_strategy`.
2566
- pub fn send_payment_with_retry ( & self , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > , payment_id : PaymentId , route_params : RouteParameters , retry_strategy : Retry ) -> Result < ( ) , PaymentSendFailure > {
2566
+ pub fn send_payment_with_retry ( & self , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > , payment_id : PaymentId , route_params : RouteParameters , retry_strategy : Retry ) -> Result < ( ) , RetryableSendFailure > {
2567
2567
let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
2568
2568
self . pending_outbound_payments
2569
2569
. send_payment ( payment_hash, payment_secret, payment_id, retry_strategy, route_params,
2570
2570
& self . router , self . list_usable_channels ( ) , || self . compute_inflight_htlcs ( ) ,
2571
2571
& self . entropy_source , & self . node_signer , best_block_height, & self . logger ,
2572
+ & self . pending_events ,
2572
2573
|path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2573
2574
self . send_payment_along_path ( path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2574
2575
}
@@ -2640,12 +2641,12 @@ where
2640
2641
/// payments.
2641
2642
///
2642
2643
/// [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
2643
- pub fn send_spontaneous_payment_with_retry ( & self , payment_preimage : Option < PaymentPreimage > , payment_id : PaymentId , route_params : RouteParameters , retry_strategy : Retry ) -> Result < PaymentHash , PaymentSendFailure > {
2644
+ pub fn send_spontaneous_payment_with_retry ( & self , payment_preimage : Option < PaymentPreimage > , payment_id : PaymentId , route_params : RouteParameters , retry_strategy : Retry ) -> Result < PaymentHash , RetryableSendFailure > {
2644
2645
let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
2645
2646
self . pending_outbound_payments . send_spontaneous_payment ( payment_preimage, payment_id,
2646
2647
retry_strategy, route_params, & self . router , self . list_usable_channels ( ) ,
2647
2648
|| self . compute_inflight_htlcs ( ) , & self . entropy_source , & self . node_signer , best_block_height,
2648
- & self . logger ,
2649
+ & self . logger , & self . pending_events ,
2649
2650
|path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
2650
2651
self . send_payment_along_path ( path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
2651
2652
}
0 commit comments