Browse Source

invoice: record expiry in data structure.

We don't enforce it yet, but you can query it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
1e6d5d82aa
  1. 4
      lightningd/invoice.c
  2. 1
      lightningd/invoice.h

4
lightningd/invoice.c

@ -152,6 +152,9 @@ static void json_invoice(struct command *cmd,
return;
}
/* Expires at this absolute time. */
invoice->expiry_time = time_now().ts.tv_sec + expiry;
wallet_invoice_save(cmd->ld->wallet, invoice);
/* Construct bolt11 string. */
@ -227,6 +230,7 @@ static void json_add_invoices(struct json_result *response,
json_add_hex(response, "rhash", &i->rhash, sizeof(i->rhash));
json_add_u64(response, "msatoshi", i->msatoshi);
json_add_bool(response, "complete", i->state == PAID);
json_add_u64(response, "expiry_time", i->expiry_time);
json_object_end(response);
}
}

1
lightningd/invoice.h

@ -23,6 +23,7 @@ struct invoice {
const char *label;
u64 msatoshi;
struct preimage r;
u64 expiry_time;
struct sha256 rhash;
};

Loading…
Cancel
Save