@@ -78,7 +78,7 @@ use core::time::Duration;
7878use core:: ops:: Deref ;
7979
8080// 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 } ;
8282
8383// We hold various information about HTLC relay in the HTLC objects in Channel itself:
8484//
@@ -2437,7 +2437,7 @@ where
24372437
24382438 let per_peer_state = self . per_peer_state . read ( ) . unwrap ( ) ;
24392439 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 ( ) } ) ?;
24412441 let mut peer_state_lock = peer_state_mutex. lock ( ) . unwrap ( ) ;
24422442 let peer_state = & mut * peer_state_lock;
24432443 if let hash_map:: Entry :: Occupied ( mut chan) = peer_state. channel_by_id . entry ( id) {
@@ -2563,12 +2563,13 @@ where
25632563
25642564 /// Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
25652565 /// `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 > {
25672567 let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
25682568 self . pending_outbound_payments
25692569 . send_payment ( payment_hash, payment_secret, payment_id, retry_strategy, route_params,
25702570 & self . router , self . list_usable_channels ( ) , || self . compute_inflight_htlcs ( ) ,
25712571 & self . entropy_source , & self . node_signer , best_block_height, & self . logger ,
2572+ & self . pending_events ,
25722573 |path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
25732574 self . send_payment_along_path ( path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
25742575 }
@@ -2640,12 +2641,12 @@ where
26402641 /// payments.
26412642 ///
26422643 /// [`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 > {
26442645 let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
26452646 self . pending_outbound_payments . send_spontaneous_payment ( payment_preimage, payment_id,
26462647 retry_strategy, route_params, & self . router , self . list_usable_channels ( ) ,
26472648 || self . compute_inflight_htlcs ( ) , & self . entropy_source , & self . node_signer , best_block_height,
2648- & self . logger ,
2649+ & self . logger , & self . pending_events ,
26492650 |path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
26502651 self . send_payment_along_path ( path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv) )
26512652 }
0 commit comments