offers: print out more details, fix up schema for decode of blinded paths.

We need to print out first_node_id, and "node_id" is now called
"blinded_node_id" in the spec.

And the schema didn't include the payment fields in the blinded path
for invoices (which broke as soon as we actually tested one!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-10-17 11:07:05 +10:30
parent e30ea91908
commit 1cdf21678e
3 changed files with 42 additions and 9 deletions

View File

@@ -45,9 +45,10 @@ If **type** is "bolt12 offer", and **valid** is *true*:
- **features** (hex, optional): the array of feature bits for this offer
- **absolute\_expiry** (u64, optional): UNIX timestamp of when this offer expires
- **paths** (array of objects, optional): Paths to the destination:
- **first\_node\_id** (pubkey): the (presumably well-known) public key of the start of the path
- **blinding** (pubkey): blinding factor for this path
- **path** (array of objects): an individual path:
- **node\_id** (pubkey): node_id of the hop
- **blinded\_node\_id** (pubkey): node_id of the hop
- **encrypted\_recipient\_data** (hex): encrypted TLV entry for this hop
- **quantity\_min** (u64, optional): the minimum quantity
- **quantity\_max** (u64, optional): the maximum quantity
@@ -73,7 +74,7 @@ If **type** is "bolt12 offer", and **valid** is *false*:
If **type** is "bolt12 invoice", and **valid** is *true*:
- **node\_id** (pubkey): public key of the offering node
- **signature** (bip340sig): BIP-340 signature of the *node_id* on this offer
- **signature** (bip340sig): BIP-340 signature of the *node_id* on this invoice
- **amount\_msat** (msat): the amount in bitcoin
- **description** (string): the description of the purpose of the offer
- **created\_at** (u64): the UNIX timestamp of invoice creation
@@ -87,10 +88,15 @@ If **type** is "bolt12 invoice", and **valid** is *true*:
- **vendor** (string, optional): the name of the vendor for this offer
- **features** (hex, optional): the array of feature bits for this offer
- **paths** (array of objects, optional): Paths to the destination:
- **first\_node\_id** (pubkey): the (presumably well-known) public key of the start of the path
- **blinding** (pubkey): blinding factor for this path
- **path** (array of objects): an individual path:
- **node\_id** (pubkey): node_id of the hop
- **blinded\_node\_id** (pubkey): node_id of the hop
- **encrypted\_recipient\_data** (hex): encrypted TLV entry for this hop
- **fee\_base\_msat** (msat, optional): base fee for the entire path
- **fee\_proportional\_millionths** (u32, optional): proportional fee for the entire path
- **cltv\_expiry\_delta** (u32, optional): total CLTV delta across path
- **features** (hex, optional): Features allowed/required for this path
- **quantity** (u64, optional): the quantity ordered
- **recurrence\_counter** (u32, optional): the 0-based counter for a recurring payment
- **recurrence\_start** (u32, optional): the optional start period for a recurring payment
@@ -211,4 +217,4 @@ RESOURCES
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:3348f74162c4a2737f1bc50f1903e7e25484747a1bc9ba7d3cd3f30b57589fdf)
[comment]: # ( SHA256STAMP:bbe57fd87e729e1203055d983a72757b9647ea67dca23c254a05b38b7b7020d9)

View File

@@ -131,11 +131,16 @@
"items": {
"type": "object",
"required": [
"first_node_id",
"blinding",
"path"
],
"additionalProperties": false,
"properties": {
"first_node_id": {
"type": "pubkey",
"description": "the (presumably well-known) public key of the start of the path"
},
"blinding": {
"type": "pubkey",
"description": "blinding factor for this path"
@@ -146,12 +151,12 @@
"items": {
"type": "object",
"required": [
"node_id",
"blinded_node_id",
"encrypted_recipient_data"
],
"additionalProperties": false,
"properties": {
"node_id": {
"blinded_node_id": {
"type": "pubkey",
"description": "node_id of the hop"
},
@@ -330,7 +335,7 @@
},
"signature": {
"type": "bip340sig",
"description": "BIP-340 signature of the *node_id* on this offer"
"description": "BIP-340 signature of the *node_id* on this invoice"
},
"chain": {
"type": "hex",
@@ -373,11 +378,16 @@
"items": {
"type": "object",
"required": [
"first_node_id",
"blinding",
"path"
],
"additionalProperties": false,
"properties": {
"first_node_id": {
"type": "pubkey",
"description": "the (presumably well-known) public key of the start of the path"
},
"blinding": {
"type": "pubkey",
"description": "blinding factor for this path"
@@ -388,18 +398,34 @@
"items": {
"type": "object",
"required": [
"node_id",
"blinded_node_id",
"encrypted_recipient_data"
],
"additionalProperties": false,
"properties": {
"node_id": {
"blinded_node_id": {
"type": "pubkey",
"description": "node_id of the hop"
},
"encrypted_recipient_data": {
"type": "hex",
"description": "encrypted TLV entry for this hop"
},
"fee_base_msat": {
"type": "msat",
"description": "base fee for the entire path"
},
"fee_proportional_millionths": {
"type": "u32",
"description": "proportional fee for the entire path"
},
"cltv_expiry_delta": {
"type": "u32",
"description": "total CLTV delta across path"
},
"features": {
"type": "hex",
"description": "Features allowed/required for this path"
}
}
}

View File

@@ -254,6 +254,7 @@ static bool json_add_blinded_paths(struct json_stream *js,
json_array_start(js, "paths");
for (size_t i = 0; i < tal_count(paths); i++) {
json_object_start(js, NULL);
json_add_pubkey(js, "first_node_id", &paths[i]->first_node_id);
json_add_pubkey(js, "blinding", &paths[i]->blinding);
json_array_start(js, "path");
for (size_t j = 0; j < tal_count(paths[i]->path); j++) {