Skip to content

Commit bf54913

Browse files
committed
global: update BOLT12 quotes.
This is a final sweep to match the current BOLT12 text: 1563d13999d342680140c693de0b9d65aa522372 ("More bolt12 test vectors.") Only two code changes, to change the order of checks to match the bolt, and to give a warning on decode if a path is empty. Signed-off-by: Rusty Russell <[email protected]>
1 parent f2a7b19 commit bf54913

File tree

16 files changed

+657
-615
lines changed

16 files changed

+657
-615
lines changed

.msggen.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@
997997
"Decode.unknown_offer_tlvs[]": 19,
998998
"Decode.valid": 2,
999999
"Decode.version": 71,
1000+
"Decode.warning_empty_blinded_path": 86,
10001001
"Decode.warning_invalid_invoice_request_signature": 39,
10011002
"Decode.warning_invalid_invoice_signature": 58,
10021003
"Decode.warning_invalid_invreq_payer_note": 37,
@@ -4815,6 +4816,10 @@
48154816
"added": "pre-v0.10.1",
48164817
"deprecated": null
48174818
},
4819+
"Decode.warning_empty_blinded_path": {
4820+
"added": "v24.08",
4821+
"deprecated": null
4822+
},
48184823
"Decode.warning_invalid_invoice_request_signature": {
48194824
"added": "pre-v0.10.1",
48204825
"deprecated": null

cln-grpc/proto/node.proto

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-rpc/src/model.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/test/run-bolt12-encode-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ int main(int argc, char *argv[])
248248
/* BOLT-offers #12:
249249
* - if it includes `offer_paths`:
250250
* - SHOULD ignore any invoice_request which does not use the path.
251-
* - MAY set `offer_issuer_id` to the node's public key to request the invoice from.
251+
* - MAY set `offer_issuer_id`.
252252
* - otherwise:
253253
* - MUST set `offer_issuer_id` to the node's public key to request the invoice from.
254254
*/

common/test/run-bolt12-format-string-test.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ int main(int argc, char *argv[])
117117
offer = tlv_offer_new(tmpctx);
118118
/* BOLT-offers #12:
119119
* A writer of an offer:
120-
* - MUST NOT set any tlv fields greater or equal to 80, or tlv field 0.
121-
* - MUST set `offer_issuer_id` to the node's public key to request the invoice from.
122-
* - MUST set `offer_description` to a complete description of the purpose
123-
* of the payment.
120+
* - MUST NOT set any TLV fields outside the inclusive ranges: 1 to 79 and 1000000000 to 1999999999.
124121
* - if the chain for the invoice is not solely bitcoin:
125122
* - MUST specify `offer_chains` the offer is valid for.
126123
* - otherwise:
@@ -134,9 +131,12 @@ int main(int argc, char *argv[])
134131
* - MUST specify `offer_currency` `iso4217` as an ISO 4712 three-letter code.
135132
* - MUST specify `offer_amount` in the currency unit adjusted by the ISO 4712
136133
* exponent (e.g. USD cents).
134+
* - MUST set `offer_description` to a complete description of the purpose
135+
* of the payment.
137136
* - otherwise:
138137
* - MUST NOT set `offer_amount`
139138
* - MUST NOT set `offer_currency`
139+
* - MAY set `offer_description`
140140
* - MAY set `offer_metadata` for its own use.
141141
* - if it supports bolt12 offer features:
142142
* - MUST set `offer_features`.`features` to the bitmap of bolt12 features.
@@ -151,6 +151,9 @@ int main(int argc, char *argv[])
151151
* - MAY include `offer_paths`.
152152
* - if it includes `offer_paths`:
153153
* - SHOULD ignore any invoice_request which does not use the path.
154+
* - MAY set `offer_issuer_id`.
155+
* - otherwise:
156+
* - MUST set `offer_issuer_id` to the node's public key to request the invoice from.
154157
* - if it sets `offer_issuer`:
155158
* - SHOULD set it to identify the issuer of the invoice clearly.
156159
* - if it includes a domain name:

contrib/msggen/msggen/schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5726,6 +5726,13 @@
57265726
}
57275727
}
57285728
},
5729+
"warning_empty_blinded_path": {
5730+
"added": "v24.08",
5731+
"type": "string",
5732+
"description": [
5733+
"The blinded path has 0 hops."
5734+
]
5735+
},
57295736
"offer_node_id": {
57305737
"type": "pubkey",
57315738
"deprecated": [

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Lines changed: 588 additions & 588 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/pyln-testing/pyln/testing/grpc2py.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,7 @@ def decode2py(m):
13121312
"unique_id": m.unique_id, # PrimitiveField in generate_composite
13131313
"valid": m.valid, # PrimitiveField in generate_composite
13141314
"version": m.version, # PrimitiveField in generate_composite
1315+
"warning_empty_blinded_path": m.warning_empty_blinded_path, # PrimitiveField in generate_composite
13151316
"warning_invalid_invoice_request_signature": m.warning_invalid_invoice_request_signature, # PrimitiveField in generate_composite
13161317
"warning_invalid_invoice_signature": m.warning_invalid_invoice_signature, # PrimitiveField in generate_composite
13171318
"warning_invalid_invreq_payer_note": m.warning_invalid_invreq_payer_note, # PrimitiveField in generate_composite

devtools/bolt12-cli.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static u64 get_offer_type(const char *name)
459459
* * [`tu64`:`max`]
460460
* 1. type: 22 (`offer_issuer_id`)
461461
* 2. data:
462-
* * [`point`:`node_id`]
462+
* * [`point`:`id`]
463463
*/
464464
{ "offer_chains", 2 },
465465
{ "offer_metadata", 4 },
@@ -510,7 +510,7 @@ static u64 get_offer_type(const char *name)
510510
* * [`tu64`:`max`]
511511
* 1. type: 22 (`offer_issuer_id`)
512512
* 2. data:
513-
* * [`point`:`node_id`]
513+
* * [`point`:`id`]
514514
* 1. type: 80 (`invreq_chain`)
515515
* 2. data:
516516
* * [`chain_hash`:`chain`]
@@ -583,7 +583,7 @@ static u64 get_offer_type(const char *name)
583583
* * [`tu64`:`max`]
584584
* 1. type: 22 (`offer_issuer_id`)
585585
* 2. data:
586-
* * [`point`:`node_id`]
586+
* * [`point`:`id`]
587587
* 1. type: 80 (`invreq_chain`)
588588
* 2. data:
589589
* * [`chain_hash`:`chain`]
@@ -602,6 +602,9 @@ static u64 get_offer_type(const char *name)
602602
* 1. type: 89 (`invreq_payer_note`)
603603
* 2. data:
604604
* * [`...*utf8`:`note`]
605+
* 1. type: 90 (`invreq_paths`)
606+
* 2. data:
607+
* * [`...*blinded_path`:`paths`]
605608
* 1. type: 160 (`invoice_paths`)
606609
* 2. data:
607610
* * [`...*blinded_path`:`paths`]

0 commit comments

Comments
 (0)