Skip to content

Commit 9582443

Browse files
committed
plugin: Do not get upset if it can't parse waitsendpay result
We were rather pedanticly failing the plugin if we were unable to parse the `waitsendpay` result, but had coded all the modifiers in such a way that they can handle a `NULL` result (verified in the code and manually by randomly failing the parsing). So we now just log the result we failed to parse and merrily go our way. Worst case is that we end up retrying the same route multiple times, since we can't blacklist any nodes / channels without understanding the error, but that is still in the scope of what we must handle anyway.
1 parent 3b54847 commit 9582443

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

plugins/libplugin-pay.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,15 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer,
663663

664664
p->result = tal_sendpay_result_from_json(p, buffer, toks);
665665

666-
if (p->result == NULL)
667-
plugin_err(
668-
p->plugin, "Unable to parse `waitsendpay` result: %.*s",
669-
json_tok_full_len(toks), json_tok_full(buffer, toks));
666+
if (p->result == NULL) {
667+
plugin_log(p->plugin, LOG_UNUSUAL,
668+
"Unable to parse `waitsendpay` result: %.*s",
669+
json_tok_full_len(toks),
670+
json_tok_full(buffer, toks));
671+
payment_set_step(p, PAYMENT_STEP_FAILED);
672+
payment_continue(p);
673+
return command_still_pending(cmd);
674+
}
670675

671676
payment_result_infer(p->route, p->result);
672677

0 commit comments

Comments
 (0)