paymod: Do not reply to the same JSON-RPC command multiple times

This commit is contained in:
Christian Decker 2020-05-18 20:16:12 +02:00
parent c35df400b2
commit df94ec35ba

View File

@ -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);