invoice: Return the invoice as a detailed error on expiration

This commit is contained in:
ZmnSCPxj
2018-02-01 11:51:19 +00:00
committed by Rusty Russell
parent 59abc37258
commit 532833cd78

View File

@@ -57,12 +57,16 @@ static void json_add_invoice(struct json_result *response,
json_object_end(response); json_object_end(response);
} }
static void tell_waiter(struct command *cmd, const struct invoice *paid) static void tell_waiter(struct command *cmd, const struct invoice *inv)
{ {
struct json_result *response = new_json_result(cmd); struct json_result *response = new_json_result(cmd);
json_add_invoice(response, paid, true); json_add_invoice(response, inv, true);
command_success(cmd, response); if (inv->state == PAID)
command_success(cmd, response);
else
command_fail_detailed(cmd, -2, response,
"invoice expired during wait");
} }
static void tell_waiter_deleted(struct command *cmd) static void tell_waiter_deleted(struct command *cmd)
{ {