From a455e5e21851bb4b4cb962a51ef60e7e1bfb87c7 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 23 Oct 2018 20:20:14 +1030 Subject: [PATCH] payalgo: correctly fail command in json_pay_failure. In e46ce0fc84001ea1860f7aa6e52947b5978970b1 I accidentally removed the actual code which fails the command. As a result, if we retry and it succeeds later, we can end up "succeeding" the started-failing command, causing us to hit the 'assert(!cmd->have_json_stream);' in new_json_stream. Signed-off-by: Rusty Russell --- lightningd/payalgo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lightningd/payalgo.c b/lightningd/payalgo.c index 1d9465a20..c0e3cbe4b 100644 --- a/lightningd/payalgo.c +++ b/lightningd/payalgo.c @@ -225,6 +225,7 @@ static void json_pay_failure(struct pay *pay, json_add_payment_fields(data, r->payment); json_add_failures(data, "failures", &pay->pay_failures); json_object_end(data); + command_failed(pay->cmd, data); return; case PAY_RHASH_ALREADY_USED: @@ -235,6 +236,7 @@ static void json_pay_failure(struct pay *pay, json_add_num(data, "sendpay_tries", pay->sendpay_tries); json_add_failures(data, "failures", &pay->pay_failures); json_object_end(data); + command_failed(pay->cmd, data); return; case PAY_UNPARSEABLE_ONION: @@ -263,6 +265,7 @@ static void json_pay_failure(struct pay *pay, fail->channel_update); json_add_failures(data, "failures", &pay->pay_failures); json_object_end(data); + command_failed(pay->cmd, data); return; case PAY_TRY_OTHER_ROUTE: