From 2e51afcc503eb422fdc96bd38fea03667ac7a948 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 24 Feb 2021 22:10:07 +0100 Subject: [PATCH] pay: Do not mark in-flight parts as failed Changelog-Fixed: pay: `pay` was reporting in-flight parts as failed --- plugins/pay.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/pay.c b/plugins/pay.c index 69517a666..13733d077 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -1521,6 +1521,11 @@ static void paystatus_add_payment(struct json_stream *s, const struct payment *p /* TODO Add routehint. */ /* TODO Add route details */ + if (p->step < PAYMENT_STEP_SPLIT) + json_add_string(s, "state", "pending"); + else + json_add_string(s, "state", "completed"); + if (p->step == PAYMENT_STEP_SPLIT) { /* Don't add anything, this is neither a success nor a failure. */ } else if (p->result != NULL) { @@ -1530,7 +1535,7 @@ static void paystatus_add_payment(struct json_stream *s, const struct payment *p json_object_start(s, "failure"); json_add_sendpay_result(s, p->result); json_object_end(s); - } else { + } else if (p->step >= PAYMENT_STEP_SPLIT) { json_object_start(s, "failure"); json_add_num(s, "code", PAY_ROUTE_NOT_FOUND); json_add_string(s, "message", "Call to getroute: Could not find a route");