Skip to content

Commit

Permalink
payalgo: correctly fail command in json_pay_failure.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rustyrussell authored and cdecker committed Oct 23, 2018
1 parent c5cd479 commit a455e5e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lightningd/payalgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ static void json_pay_failure(struct pay *pay,
json_add_payment_fields(data, r->payment);
json_add_failures(data, "failures", &pay->pay_failures);
json_object_end(data);
command_failed(pay->cmd, data);
return;

case PAY_RHASH_ALREADY_USED:
Expand All @@ -235,6 +236,7 @@ static void json_pay_failure(struct pay *pay,
json_add_num(data, "sendpay_tries", pay->sendpay_tries);
json_add_failures(data, "failures", &pay->pay_failures);
json_object_end(data);
command_failed(pay->cmd, data);
return;

case PAY_UNPARSEABLE_ONION:
Expand Down Expand Up @@ -263,6 +265,7 @@ static void json_pay_failure(struct pay *pay,
fail->channel_update);
json_add_failures(data, "failures", &pay->pay_failures);
json_object_end(data);
command_failed(pay->cmd, data);
return;

case PAY_TRY_OTHER_ROUTE:
Expand Down

0 comments on commit a455e5e

Please sign in to comment.