Browse Source

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.
fixup-0.9.0
Christian Decker 5 years ago
parent
commit
958244367c
  1. 13
      plugins/libplugin-pay.c

13
plugins/libplugin-pay.c

@ -663,10 +663,15 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer,
p->result = tal_sendpay_result_from_json(p, buffer, toks); p->result = tal_sendpay_result_from_json(p, buffer, toks);
if (p->result == NULL) if (p->result == NULL) {
plugin_err( plugin_log(p->plugin, LOG_UNUSUAL,
p->plugin, "Unable to parse `waitsendpay` result: %.*s", "Unable to parse `waitsendpay` result: %.*s",
json_tok_full_len(toks), json_tok_full(buffer, toks)); 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); payment_result_infer(p->route, p->result);

Loading…
Cancel
Save