db: add invoicerequests table.

We no longer use offers for "I want to send you money", but we'll use
invoice_requests directly.  Create a new table for them, and
associated functions.

The "localofferid" for "pay" and "sendpay" is now "localinvreqid".
This is an experimental-only option, so document the change under
experimental only.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: JSON-RPC: `pay` and `sendpay` `localofferid` is now `localinvreqid`.
This commit is contained in:
Rusty Russell
2022-11-09 13:02:01 +10:30
committed by Christian Decker
parent 891cef7b2b
commit 02d7454226
20 changed files with 634 additions and 372 deletions

View File

@@ -987,7 +987,7 @@ static struct command_result *json_pay(struct command *cmd,
struct shadow_route_data *shadow_route;
struct amount_msat *invmsat;
u64 invexpiry;
struct sha256 *local_offer_id;
struct sha256 *local_invreq_id;
const struct tlv_invoice *b12;
struct out_req *req;
struct route_exclusion **exclusions;
@@ -1011,7 +1011,7 @@ static struct command_result *json_pay(struct command *cmd,
p_opt_def("maxdelay", param_number, &maxdelay,
maxdelay_default),
p_opt("exemptfee", param_msat, &exemptfee),
p_opt("localofferid", param_sha256, &local_offer_id),
p_opt("localinvreqid", param_sha256, &local_invreq_id),
p_opt("exclude", param_route_exclusion_array, &exclusions),
p_opt("maxfee", param_msat, &maxfee),
p_opt("description", param_string, &description),
@@ -1159,7 +1159,7 @@ static struct command_result *json_pay(struct command *cmd,
invexpiry = *b12->invoice_created_at + *b12->invoice_relative_expiry;
else
invexpiry = *b12->invoice_created_at + BOLT12_DEFAULT_REL_EXPIRY;
p->local_offer_id = tal_steal(p, local_offer_id);
p->local_invreq_id = tal_steal(p, local_invreq_id);
}
if (time_now().ts.tv_sec > invexpiry)