@@ -140,10 +140,8 @@ static struct pf_result *handle_unhandleable_error(struct pay_flow *pf,
140140 /* Assume it's not the destination */
141141 n = pseudorand (n - 1 );
142142
143- tal_arr_expand (& pf -> payment -> disabled , pf -> path_scidds [n ].scid );
144- payflow_note (pf , LOG_DBG , "... eliminated %s" ,
145- type_to_string (tmpctx , struct short_channel_id ,
146- & pf -> path_scidds [n ].scid ));
143+ payflow_disable_chan (pf , pf -> path_scidds [n ].scid ,
144+ LOG_INFORM , "randomly chosen" );
147145
148146 return pay_flow_failed (pf );
149147}
@@ -175,14 +173,11 @@ static struct command_result *addgossip_failure(struct command *cmd,
175173 struct addgossip * adg )
176174
177175{
178- struct payment * payment = adg -> pf -> payment ;
179176 plugin_log (pay_plugin -> plugin ,LOG_DBG ,"calling %s" ,__PRETTY_FUNCTION__ );
180177
181- payflow_note (adg -> pf , LOG_UNUSUAL ,
182- "addgossip failed, removing channel %s (%.*s)" ,
183- type_to_string (tmpctx , struct short_channel_id , & adg -> scid ),
184- err -> end - err -> start , buf + err -> start );
185- tal_arr_expand (& payment -> disabled , adg -> scid );
178+ payflow_disable_chan (adg -> pf , adg -> scid ,
179+ LOG_INFORM , "addgossip failed (%.*s)" ,
180+ err -> end - err -> start , buf + err -> start );
186181
187182 return addgossip_done (cmd , buf , err , adg );
188183}
@@ -307,12 +302,11 @@ static struct command_result *flow_sendpay_failed(struct command *cmd,
307302 plugin_err (cmd -> plugin , "Strange error from sendpay: %.*s" ,
308303 json_tok_full_len (err ), json_tok_full (buf , err ));
309304
310- payflow_note (pf , LOG_INFORM ,
311- "sendpay didn't like first hop, eliminated: %s" , msg );
312-
313305 /* There is no new knowledge from this kind of failure.
314306 * We just disable this scid. */
315- tal_arr_expand (& payment -> disabled , pf -> path_scidds [0 ].scid );
307+ payflow_disable_chan (pf , pf -> path_scidds [0 ].scid ,
308+ LOG_INFORM ,
309+ "sendpay didn't like first hop: %s" , msg );
316310
317311 pay_flow_failed (pf );
318312 return command_still_pending (cmd );
@@ -1075,13 +1069,6 @@ static struct pf_result *handle_sendpay_failure_payment(struct pay_flow *pf STEA
10751069 }
10761070
10771071 errscid = pf -> path_scidds [erridx ].scid ;
1078- debug_paynote (p ,
1079- "onion error %s from node #%u %s: %s" ,
1080- onion_wire_name (onionerr ),
1081- erridx ,
1082- type_to_string (tmpctx , struct short_channel_id , & errscid ),
1083- message );
1084-
10851072 switch (onionerr ) {
10861073 /* These definitely mean eliminate channel */
10871074 case WIRE_PERMANENT_CHANNEL_FAILURE :
@@ -1101,9 +1088,9 @@ static struct pf_result *handle_sendpay_failure_payment(struct pay_flow *pf STEA
11011088 case WIRE_INVALID_ONION_PAYLOAD :
11021089 case WIRE_INVALID_ONION_BLINDING :
11031090 case WIRE_EXPIRY_TOO_FAR :
1104- debug_paynote ( p , "we're removing scid %s" ,
1105- type_to_string ( tmpctx , struct short_channel_id , & errscid ));
1106- tal_arr_expand ( & p -> disabled , errscid );
1091+ payflow_disable_chan ( pf , errscid , LOG_UNUSUAL ,
1092+ "%s" ,
1093+ onion_wire_name ( onionerr ) );
11071094 return pay_flow_failed (pf );
11081095
11091096 /* These can be fixed (maybe) by applying the included channel_update */
@@ -1118,9 +1105,8 @@ static struct pf_result *handle_sendpay_failure_payment(struct pay_flow *pf STEA
11181105 if (update )
11191106 return submit_update (pf , update , errscid );
11201107
1121- debug_paynote (p , "missing an update, so we're removing scid %s" ,
1122- type_to_string (tmpctx ,struct short_channel_id ,& errscid ));
1123- tal_arr_expand (& p -> disabled , errscid );
1108+ payflow_disable_chan (pf , errscid ,
1109+ LOG_UNUSUAL , "missing channel_update" );
11241110 return pay_flow_failed (pf );
11251111
11261112 case WIRE_TEMPORARY_CHANNEL_FAILURE :
@@ -1140,10 +1126,9 @@ static struct pf_result *handle_sendpay_failure_payment(struct pay_flow *pf STEA
11401126 break ;
11411127 }
11421128
1143- debug_paynote (p ,"unkown onion error code %u, removing scid %s" ,
1144- onionerr ,
1145- type_to_string (tmpctx ,struct short_channel_id ,& errscid ));
1146- tal_arr_expand (& p -> disabled , errscid );
1129+ payflow_disable_chan (pf , errscid ,
1130+ LOG_UNUSUAL , "unexpected error code %u" ,
1131+ onionerr );
11471132 return pay_flow_failed (pf );
11481133}
11491134
0 commit comments