bolt12: import latest spec (timestamp -> created_at).

@shesek points out that we called this field created_at in bolt11 decode,
which makes more sense anyway.

Changelog-EXPERIMENTAL: bolt12 decode `timestamp` field deprecated in favor of new name `created_at`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-07-21 11:01:39 +09:30
committed by neil saitug
parent 90c5f9a051
commit 7769903f1a
13 changed files with 82 additions and 75 deletions

View File

@@ -153,11 +153,11 @@ If \fBtype\fR is "bolt12 invoice", and \fBvalid\fR is \fItrue\fR:
.IP \[bu]
\fBdescription\fR (string): the description of the purpose of the offer
.IP \[bu]
\fBtimestamp\fR (u64): the UNIX timestamp of the invoice
\fBcreated_at\fR (u64): the UNIX timestamp of invoice creation
.IP \[bu]
\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR (always 64 characters)
.IP \[bu]
\fBrelative_expiry\fR (u32): the number of seconds after \fItimestamp\fR when this expires
\fBrelative_expiry\fR (u32): the number of seconds after \fIcreated_at\fR when this expires
.IP \[bu]
\fBmin_final_cltv_expiry\fR (u32): the number of blocks required by destination
.IP \[bu]
@@ -256,7 +256,7 @@ the following warnings are possible:
.IP \[bu]
\fBwarning_invoice_missing_recurrence_basetime\fR: Has \fBrecurrence_counter\fR without \fBrecurrence_basetime\fR
.IP \[bu]
\fBwarning_invoice_missing_timestamp\fR: Missing \fBtimestamp\fR
\fBwarning_invoice_missing_created_at\fR: Missing \fBcreated_at\fR
.IP \[bu]
\fBwarning_invoice_missing_payment_hash\fR: Missing \fBpayment_hash\fR
.IP \[bu]
@@ -414,4 +414,4 @@ Rusty Russell \fI<rusty@rustcorp.com.au\fR> is mainly responsible\.
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:cd54af7c631f06b3db72848cdf90951ceb14d89b8bca981dba69244cd2ddbae5
\" SHA256STAMP:dda6e1cff3e58c38b637c5a11673b5a9f4837cbdf89ed3be52a8bfc874af87d4

View File

@@ -70,9 +70,9 @@ If **type** is "bolt12 invoice", and **valid** is *true*:
- **signature** (bip340sig): BIP-340 signature of the *node_id* on this offer
- **amount_msat** (msat): the amount in bitcoin
- **description** (string): the description of the purpose of the offer
- **timestamp** (u64): the UNIX timestamp of the invoice
- **created_at** (u64): the UNIX timestamp of invoice creation
- **payment_hash** (hex): the hash of the *payment_preimage* (always 64 characters)
- **relative_expiry** (u32): the number of seconds after *timestamp* when this expires
- **relative_expiry** (u32): the number of seconds after *created_at* when this expires
- **min_final_cltv_expiry** (u32): the number of blocks required by destination
- **offer_id** (hex, optional): the id of this offer (merkle hash of non-signature fields) (always 64 characters)
- **chains** (array of hexs, optional): which blockchains this offer is for (missing implies bitcoin mainnet only):
@@ -108,7 +108,7 @@ If **type** is "bolt12 invoice", and **valid** is *false*:
- **warning_invoice_missing_blinded_payinfo**: Has **paths** without payinfo
- **warning_invoice_invalid_blinded_payinfo**: Does not have exactly one payinfo for each of **paths**
- **warning_invoice_missing_recurrence_basetime**: Has **recurrence_counter** without **recurrence_basetime**
- **warning_invoice_missing_timestamp**: Missing **timestamp**
- **warning_invoice_missing_created_at**: Missing **created_at**
- **warning_invoice_missing_payment_hash**: Missing **payment_hash**
- **warning_invoice_refund_signature_missing_payer_key**: Missing **payer_key** for refund_signature
- **warning_invoice_refund_signature_invalid**: **refund_signature** incorrect
@@ -183,4 +183,4 @@ RESOURCES
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:8ca0b9178b8ea6575cd80291001263dc27f721664648086a7c1a02efcb545ee7)
[comment]: # ( SHA256STAMP:fbbfc116c23489d4f346b4d5eb06dd922592c543ec68e5a76b6822b2658bd46d)

View File

@@ -263,7 +263,7 @@
}
},
"then": {
"required": [ "node_id", "signature", "amount_msat", "description", "timestamp", "payment_hash", "relative_expiry", "min_final_cltv_expiry" ],
"required": [ "node_id", "signature", "amount_msat", "description", "created_at", "payment_hash", "relative_expiry", "min_final_cltv_expiry" ],
"additionalProperties": false,
"properties": {
"type": { },
@@ -378,8 +378,11 @@
"description": "the payer-provided blob to derive payer_key"
},
"timestamp": {
"deprecated": true
},
"created_at": {
"type": "u64",
"description": "the UNIX timestamp of the invoice"
"description": "the UNIX timestamp of invoice creation"
},
"payment_hash": {
"type": "hex",
@@ -389,7 +392,7 @@
},
"relative_expiry": {
"type": "u32",
"description": "the number of seconds after *timestamp* when this expires"
"description": "the number of seconds after *created_at* when this expires"
},
"min_final_cltv_expiry": {
"type": "u32",
@@ -462,6 +465,7 @@
"payer_key": { },
"payer_info": { },
"timestamp": { },
"created_at": { },
"payment_hash": { },
"relative_expiry": { },
"min_final_cltv_expiry": { },
@@ -487,9 +491,9 @@
"type": "string",
"description": "Has **recurrence_counter** without **recurrence_basetime**"
},
"warning_invoice_missing_timestamp": {
"warning_invoice_missing_created_at": {
"type": "string",
"description": "Missing **timestamp**"
"description": "Missing **created_at**"
},
"warning_invoice_missing_payment_hash": {
"type": "string",