From bbedd3819d0eb0047c0c3cb4e8f74b9ab6763e4a Mon Sep 17 00:00:00 2001 From: Simon Vrouwe Date: Tue, 4 Jun 2019 13:03:02 +0300 Subject: [PATCH] plugins/pay.c: add curly braces arround JSON data field fixes #2698 --- CHANGELOG.md | 1 + plugins/pay.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00d01203b..e8cecda63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ changes. - Fixed `fundchannel` crash when we have many UTXOs and we skip unconfirmed ones. - lightningd: fixed occasional hang on `connect` when peer had sent error. - JSON RPC: `decodeinvoice` and `pay` now handle unknown invoice fields properly. +- JSON API: `waitsendpay` (PAY_STOPPED_RETRYING) error handler now returns valid JSON ### Security diff --git a/plugins/pay.c b/plugins/pay.c index 99b698e6d..9679da502 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -168,7 +168,7 @@ static struct command_result *waitsendpay_expired(struct command *cmd, errmsg = tal_fmt(pc, "Gave up after %zu attempts", tal_count(pc->ps->attempts)); - data = tal_strdup(pc, "'attempts': [ "); + data = tal_strdup(pc, "{ 'attempts': [ "); for (size_t i = 0; i < tal_count(pc->ps->attempts); i++) { if (pc->ps->attempts[i].route) tal_append_fmt(&data, "%s { 'route': %s,\n 'failure': %s\n }", @@ -180,7 +180,7 @@ static struct command_result *waitsendpay_expired(struct command *cmd, i == 0 ? "" : ",", pc->ps->attempts[i].failure); } - tal_append_fmt(&data, "]"); + tal_append_fmt(&data, "] }"); return command_done_err(cmd, PAY_STOPPED_RETRYING, errmsg, data); }