Skip to content

Commit a455e5e

Browse files
rustyrussellcdecker
authored andcommitted
payalgo: correctly fail command in json_pay_failure.
In e46ce0f I accidentally removed the actual code which fails the command. As a result, if we retry and it succeeds later, we can end up "succeeding" the started-failing command, causing us to hit the 'assert(!cmd->have_json_stream);' in new_json_stream. Signed-off-by: Rusty Russell <[email protected]>
1 parent c5cd479 commit a455e5e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lightningd/payalgo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ static void json_pay_failure(struct pay *pay,
225225
json_add_payment_fields(data, r->payment);
226226
json_add_failures(data, "failures", &pay->pay_failures);
227227
json_object_end(data);
228+
command_failed(pay->cmd, data);
228229
return;
229230

230231
case PAY_RHASH_ALREADY_USED:
@@ -235,6 +236,7 @@ static void json_pay_failure(struct pay *pay,
235236
json_add_num(data, "sendpay_tries", pay->sendpay_tries);
236237
json_add_failures(data, "failures", &pay->pay_failures);
237238
json_object_end(data);
239+
command_failed(pay->cmd, data);
238240
return;
239241

240242
case PAY_UNPARSEABLE_ONION:
@@ -263,6 +265,7 @@ static void json_pay_failure(struct pay *pay,
263265
fail->channel_update);
264266
json_add_failures(data, "failures", &pay->pay_failures);
265267
json_object_end(data);
268+
command_failed(pay->cmd, data);
266269
return;
267270

268271
case PAY_TRY_OTHER_ROUTE:

0 commit comments

Comments
 (0)