@@ -2419,10 +2419,10 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
24192419 let session_priv = SecretKey :: from_slice ( & session_priv_bytes[ ..] ) . expect ( "RNG is busted" ) ;
24202420
24212421 let onion_keys = onion_utils:: construct_onion_keys ( & self . secp_ctx , & path, & session_priv)
2422- . map_err ( |_| APIError :: RouteError { err : "Pubkey along hop was maliciously selected" } ) ?;
2422+ . map_err ( |_| APIError :: InvalidRoute { err : "Pubkey along hop was maliciously selected" } ) ?;
24232423 let ( onion_payloads, htlc_msat, htlc_cltv) = onion_utils:: build_onion_payloads ( path, total_value, payment_secret, cur_height, keysend_preimage) ?;
24242424 if onion_utils:: route_size_insane ( & onion_payloads) {
2425- return Err ( APIError :: RouteError { err : "Route size too large considering onion data" } ) ;
2425+ return Err ( APIError :: InvalidRoute { err : "Route size too large considering onion data" } ) ;
24262426 }
24272427 let onion_packet = onion_utils:: construct_onion_packet ( onion_payloads, onion_keys, prng_seed, payment_hash) ;
24282428
@@ -2439,7 +2439,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
24392439 if let hash_map:: Entry :: Occupied ( mut chan) = channel_state. by_id . entry ( id) {
24402440 match {
24412441 if chan. get ( ) . get_counterparty_node_id ( ) != path. first ( ) . unwrap ( ) . pubkey {
2442- return Err ( APIError :: RouteError { err : "Node ID mismatch on first hop!" } ) ;
2442+ return Err ( APIError :: InvalidRoute { err : "Node ID mismatch on first hop!" } ) ;
24432443 }
24442444 if !chan. get ( ) . is_live ( ) {
24452445 return Err ( APIError :: ChannelUnavailable { err : "Peer for first hop currently disconnected/pending monitor update!" . to_owned ( ) } ) ;
@@ -2514,7 +2514,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
25142514 /// fields for more info.
25152515 ///
25162516 /// If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
2517- /// method will error with an [`APIError::RouteError `]. Note, however, that once a payment
2517+ /// method will error with an [`APIError::InvalidRoute `]. Note, however, that once a payment
25182518 /// is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
25192519 /// [`Event::PaymentSent`]) LDK will not stop you from sending a second payment with the same
25202520 /// [`PaymentId`].
@@ -2533,7 +2533,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
25332533 /// PaymentSendFailure for more info.
25342534 ///
25352535 /// In general, a path may raise:
2536- /// * [`APIError::RouteError `] when an invalid route or forwarding parameter (cltv_delta, fee,
2536+ /// * [`APIError::InvalidRoute `] when an invalid route or forwarding parameter (cltv_delta, fee,
25372537 /// node public key) is specified.
25382538 /// * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
25392539 /// (including due to previous monitor update failure or new permanent monitor update
@@ -2598,7 +2598,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
25982598
25992599 fn send_payment_internal ( & self , route : & Route , payment_hash : PaymentHash , payment_secret : & Option < PaymentSecret > , keysend_preimage : Option < PaymentPreimage > , payment_id : PaymentId , recv_value_msat : Option < u64 > , onion_session_privs : Vec < [ u8 ; 32 ] > ) -> Result < ( ) , PaymentSendFailure > {
26002600 if route. paths . len ( ) < 1 {
2601- return Err ( PaymentSendFailure :: ParameterError ( APIError :: RouteError { err : "There must be at least one path to send over" } ) ) ;
2601+ return Err ( PaymentSendFailure :: ParameterError ( APIError :: InvalidRoute { err : "There must be at least one path to send over" } ) ) ;
26022602 }
26032603 if payment_secret. is_none ( ) && route. paths . len ( ) > 1 {
26042604 return Err ( PaymentSendFailure :: ParameterError ( APIError :: APIMisuseError { err : "Payment secret is required for multi-path payments" . to_string ( ) } ) ) ;
@@ -2608,12 +2608,12 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
26082608 let mut path_errs = Vec :: with_capacity ( route. paths . len ( ) ) ;
26092609 ' path_check: for path in route. paths . iter ( ) {
26102610 if path. len ( ) < 1 || path. len ( ) > 20 {
2611- path_errs. push ( Err ( APIError :: RouteError { err : "Path didn't go anywhere/had bogus size" } ) ) ;
2611+ path_errs. push ( Err ( APIError :: InvalidRoute { err : "Path didn't go anywhere/had bogus size" } ) ) ;
26122612 continue ' path_check;
26132613 }
26142614 for ( idx, hop) in path. iter ( ) . enumerate ( ) {
26152615 if idx != path. len ( ) - 1 && hop. pubkey == our_node_id {
2616- path_errs. push ( Err ( APIError :: RouteError { err : "Path went through us but wasn't a simple rebalance loop to us" } ) ) ;
2616+ path_errs. push ( Err ( APIError :: InvalidRoute { err : "Path went through us but wasn't a simple rebalance loop to us" } ) ) ;
26172617 continue ' path_check;
26182618 }
26192619 }
@@ -3092,20 +3092,20 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
30923092 let next_hop_scid = match self . channel_state . lock ( ) . unwrap ( ) . by_id . get ( next_hop_channel_id) {
30933093 Some ( chan) => {
30943094 if !chan. is_usable ( ) {
3095- return Err ( APIError :: APIMisuseError {
3096- err : format ! ( "Channel with id {:? } not fully established" , next_hop_channel_id)
3095+ return Err ( APIError :: ChannelUnavailable {
3096+ err : format ! ( "Channel with id {} not fully established" , log_bytes! ( * next_hop_channel_id) )
30973097 } )
30983098 }
30993099 chan. get_short_channel_id ( ) . unwrap_or ( chan. outbound_scid_alias ( ) )
31003100 } ,
3101- None => return Err ( APIError :: APIMisuseError {
3102- err : format ! ( "Channel with id {:? } not found" , next_hop_channel_id)
3101+ None => return Err ( APIError :: ChannelUnavailable {
3102+ err : format ! ( "Channel with id {} not found" , log_bytes! ( * next_hop_channel_id) )
31033103 } )
31043104 } ;
31053105
31063106 let payment = self . pending_intercepted_htlcs . lock ( ) . unwrap ( ) . remove ( & intercept_id)
31073107 . ok_or_else ( || APIError :: APIMisuseError {
3108- err : format ! ( "Payment with intercept id {:? } not found" , intercept_id. 0 )
3108+ err : format ! ( "Payment with intercept id {} not found" , log_bytes! ( intercept_id. 0 ) )
31093109 } ) ?;
31103110
31113111 let routing = match payment. forward_info . routing {
@@ -3140,7 +3140,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
31403140
31413141 let payment = self . pending_intercepted_htlcs . lock ( ) . unwrap ( ) . remove ( & intercept_id)
31423142 . ok_or_else ( || APIError :: APIMisuseError {
3143- err : format ! ( "Payment with InterceptId {:? } not found" , intercept_id)
3143+ err : format ! ( "Payment with intercept id { } not found" , log_bytes! ( intercept_id. 0 ) )
31443144 } ) ?;
31453145
31463146 if let PendingHTLCRouting :: Forward { short_channel_id, .. } = payment. forward_info . routing {
0 commit comments