mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
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>
This commit is contained in:
committed by
Christian Decker
parent
2d05644dfd
commit
1e6d5d82aa
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ struct invoice {
|
||||
const char *label;
|
||||
u64 msatoshi;
|
||||
struct preimage r;
|
||||
u64 expiry_time;
|
||||
struct sha256 rhash;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user