@@ -1003,6 +1003,7 @@ impl OutboundPayments {
1003
1003
#[ cfg( not( test) ) ]
1004
1004
let ( network_update, short_channel_id, payment_retryable, _, _) = onion_error. decode_onion_failure ( secp_ctx, logger, & source) ;
1005
1005
1006
+ let payment_is_probe = payment_is_probe ( payment_hash, & payment_id, probing_cookie_secret) ;
1006
1007
let mut session_priv_bytes = [ 0 ; 32 ] ;
1007
1008
session_priv_bytes. copy_from_slice ( & session_priv[ ..] ) ;
1008
1009
let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
@@ -1019,7 +1020,7 @@ impl OutboundPayments {
1019
1020
log_trace ! ( logger, "Received failure of HTLC with payment_hash {} after payment completion" , log_bytes!( payment_hash. 0 ) ) ;
1020
1021
return
1021
1022
}
1022
- let is_retryable_now = payment. get ( ) . is_auto_retryable_now ( ) ;
1023
+ let mut is_retryable_now = payment. get ( ) . is_auto_retryable_now ( ) ;
1023
1024
if let Some ( scid) = short_channel_id {
1024
1025
payment. get_mut ( ) . insert_previously_failed_scid ( scid) ;
1025
1026
}
@@ -1050,6 +1051,12 @@ impl OutboundPayments {
1050
1051
} ) ;
1051
1052
}
1052
1053
1054
+ // Abandon if we were rejected by the destination, the payment is not retryable, or no retry
1055
+ // parameters are available
1056
+ if !is_retryable_now || !payment_retryable || ( !payment_is_probe && retry. is_none ( ) ) {
1057
+ let _ = payment. get_mut ( ) . mark_abandoned ( ) ; // we'll only Err if it's a legacy payment
1058
+ is_retryable_now = false ;
1059
+ }
1053
1060
if payment. get ( ) . remaining_parts ( ) == 0 {
1054
1061
all_paths_failed = true ;
1055
1062
if payment. get ( ) . abandoned ( ) {
@@ -1069,7 +1076,7 @@ impl OutboundPayments {
1069
1076
log_trace ! ( logger, "Failing outbound payment HTLC with payment_hash {}" , log_bytes!( payment_hash. 0 ) ) ;
1070
1077
1071
1078
let path_failure = {
1072
- if payment_is_probe ( payment_hash , & payment_id , probing_cookie_secret ) {
1079
+ if payment_is_probe {
1073
1080
if !payment_retryable {
1074
1081
events:: Event :: ProbeSuccessful {
1075
1082
payment_id : * payment_id,
0 commit comments