From 532833cd783601de9065bdeae9ab009e95a9e3cf Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Thu, 1 Feb 2018 11:51:19 +0000 Subject: [PATCH] invoice: Return the invoice as a detailed error on expiration --- lightningd/invoice.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lightningd/invoice.c b/lightningd/invoice.c index 28f131aa8..866525c59 100644 --- a/lightningd/invoice.c +++ b/lightningd/invoice.c @@ -57,12 +57,16 @@ static void json_add_invoice(struct json_result *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); - json_add_invoice(response, paid, true); - command_success(cmd, response); + json_add_invoice(response, inv, true); + 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) {