Browse Source

pay: Do not duplicate "message" field in response to `pay`

mpp
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
f20091fc72
  1. 11
      plugins/libplugin-pay.c

11
plugins/libplugin-pay.c

@ -1039,6 +1039,7 @@ static void payment_finished(struct payment *p)
struct payment_tree_result result = payment_collect_result(p); struct payment_tree_result result = payment_collect_result(p);
struct json_stream *ret; struct json_stream *ret;
struct command *cmd = p->cmd; struct command *cmd = p->cmd;
const char *msg;
/* Either none of the leaf attempts succeeded yet, or we have a /* Either none of the leaf attempts succeeded yet, or we have a
* preimage. */ * preimage. */
@ -1085,15 +1086,13 @@ static void payment_finished(struct payment *p)
return; return;
} else if (result.failure == NULL || result.failure->failcode < NODE) { } else if (result.failure == NULL || result.failure->failcode < NODE) {
/* This is failing because we have no more routes to try */ /* This is failing because we have no more routes to try */
ret = jsonrpc_stream_fail(cmd, PAY_STOPPED_RETRYING, msg = tal_fmt(cmd,
NULL);
json_add_string(
ret, "message",
tal_fmt(cmd,
"Ran out of routes to try after " "Ran out of routes to try after "
"%d attempt%s: see `paystatus`", "%d attempt%s: see `paystatus`",
result.attempts, result.attempts,
result.attempts == 1 ? "" : "s")); result.attempts == 1 ? "" : "s");
ret = jsonrpc_stream_fail(cmd, PAY_STOPPED_RETRYING,
msg);
payment_json_add_attempts(ret, "attempts", p); payment_json_add_attempts(ret, "attempts", p);
if (command_finished(cmd, ret)) {/* Ignore result. */} if (command_finished(cmd, ret)) {/* Ignore result. */}
return; return;

Loading…
Cancel
Save