From df94ec35ba365561dbe361181941bcd37a3b3729 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 18 May 2020 20:16:12 +0200 Subject: [PATCH] paymod: Do not reply to the same JSON-RPC command multiple times --- plugins/libplugin-pay.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index a39c5eb40..333e83688 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -579,8 +579,12 @@ static void payment_finished(struct payment *p) assert((result.leafstates & PAYMENT_STEP_SUCCESS) == 0 || result.preimage != NULL); - if (p->parent == NULL) { - assert(p->cmd != NULL); + if (p->parent == NULL && cmd == NULL) { + /* This is the tree root, but we already reported success or + * failure, so noop. */ + return; + + } else if (p->parent == NULL) { if (payment_is_success(p)) { assert(result.treestates & PAYMENT_STEP_SUCCESS); assert(result.leafstates & PAYMENT_STEP_SUCCESS);