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.
This commit is contained in:
Christian Decker 2020-07-17 16:07:27 +02:00
parent 3b54847ae4
commit 958244367c

View File

@ -663,10 +663,15 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer,
p->result = tal_sendpay_result_from_json(p, buffer, toks);
if (p->result == NULL)
plugin_err(
p->plugin, "Unable to parse `waitsendpay` result: %.*s",
json_tok_full_len(toks), json_tok_full(buffer, toks));
if (p->result == NULL) {
plugin_log(p->plugin, LOG_UNUSUAL,
"Unable to parse `waitsendpay` result: %.*s",
json_tok_full_len(toks),
json_tok_full(buffer, toks));
payment_set_step(p, PAYMENT_STEP_FAILED);
payment_continue(p);
return command_still_pending(cmd);
}
payment_result_infer(p->route, p->result);