From 958244367c175fe399828e3c09af8a4470691836 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 17 Jul 2020 16:07:27 +0200 Subject: [PATCH] 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. --- plugins/libplugin-pay.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index b53f73047..2525786a9 100644 --- a/plugins/libplugin-pay.c +++ b/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); - 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);