Skip to content

Commit

Permalink
plugins/offers: handle invreq_paths in invoice_requests, set them if …
Browse files Browse the repository at this point in the history
…necessary.

Changelog-EXPERIMENTAL: offers: `invoicerequest` will set a blinded path if we're an unannounced node.
Changelog-EXPERIMENTAL: offers: `sendinvoice` will use a blinded path in an invoice_request, if specified.
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Aug 1, 2024
1 parent 71270ae commit f2a7b19
Show file tree
Hide file tree
Showing 14 changed files with 1,191 additions and 616 deletions.
44 changes: 44 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,17 @@
"Decode.invoice_paths[].path[].blinded_node_id": 1,
"Decode.invoice_paths[].path[].encrypted_recipient_data": 2
},
"DecodeInvreq_paths": {
"Decode.invreq_paths[].blinding": 2,
"Decode.invreq_paths[].first_node_id": 3,
"Decode.invreq_paths[].first_scid": 4,
"Decode.invreq_paths[].first_scid_dir": 1,
"Decode.invreq_paths[].path[]": 5
},
"DecodeInvreq_pathsPath": {
"Decode.invreq_paths[].path[].blinded_node_id": 1,
"Decode.invreq_paths[].path[].encrypted_recipient_data": 2
},
"DecodeOffer_paths": {
"Decode.offer_paths[].blinding": 2,
"Decode.offer_paths[].first_node_id": 1,
Expand Down Expand Up @@ -948,6 +959,7 @@
"Decode.invreq_chain": 27,
"Decode.invreq_features": 29,
"Decode.invreq_metadata": 25,
"Decode.invreq_paths[]": 85,
"Decode.invreq_payer_id": 26,
"Decode.invreq_payer_note": 31,
"Decode.invreq_quantity": 30,
Expand Down Expand Up @@ -4491,6 +4503,38 @@
"added": "pre-v0.10.1",
"deprecated": null
},
"Decode.invreq_paths[]": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_paths[].blinding": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_paths[].first_node_id": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_paths[].first_scid": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_paths[].first_scid_dir": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_paths[].path[]": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_paths[].path[].blinded_node_id": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_paths[].path[].encrypted_recipient_data": {
"added": "v24.08",
"deprecated": null
},
"Decode.invreq_payer_id": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
14 changes: 14 additions & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

154 changes: 154 additions & 0 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6282,6 +6282,82 @@
"A note attached by the payer."
]
},
"invreq_paths": {
"type": "array",
"added": "v24.08",
"description": [
"Paths to the destination."
],
"items": {
"type": "object",
"required": [
"blinding",
"path"
],
"additionalProperties": false,
"properties": {
"first_node_id": {
"added": "v24.08",
"type": "pubkey",
"description": [
"The (presumably well-known) public key of the start of the path."
]
},
"first_scid": {
"added": "v24.08",
"type": "short_channel_id",
"description": [
"the short channel id of the start of the path (alternative to first_node_id)"
]
},
"first_scid_dir": {
"added": "v24.08",
"type": "u32",
"description": [
"which end of the first_scid is the start of the path"
]
},
"blinding": {
"added": "v24.08",
"type": "pubkey",
"description": [
"Blinding factor for this path."
]
},
"path": {
"type": "array",
"added": "v24.08",
"description": [
"An individual path."
],
"items": {
"type": "object",
"required": [
"blinded_node_id",
"encrypted_recipient_data"
],
"additionalProperties": false,
"properties": {
"blinded_node_id": {
"added": "v24.08",
"type": "pubkey",
"description": [
"Node_id of the hop."
]
},
"encrypted_recipient_data": {
"added": "v24.08",
"type": "hex",
"description": [
"Encrypted TLV entry for this hop."
]
}
}
}
}
}
}
},
"invreq_recurrence_counter": {
"type": "u32",
"description": [
Expand Down Expand Up @@ -6385,6 +6461,7 @@
"invreq_features": {},
"invreq_quantity": {},
"invreq_payer_note": {},
"invreq_paths": {},
"invreq_recurrence_counter": {},
"invreq_recurrence_start": {},
"warning_invalid_offer_description": {
Expand Down Expand Up @@ -6780,6 +6857,82 @@
"A note attached by the payer."
]
},
"invreq_paths": {
"type": "array",
"added": "v24.08",
"description": [
"Paths to the destination."
],
"items": {
"type": "object",
"required": [
"blinding",
"path"
],
"additionalProperties": false,
"properties": {
"first_node_id": {
"added": "v24.08",
"type": "pubkey",
"description": [
"The (presumably well-known) public key of the start of the path."
]
},
"first_scid": {
"added": "v24.08",
"type": "short_channel_id",
"description": [
"the short channel id of the start of the path (alternative to first_node_id)"
]
},
"first_scid_dir": {
"added": "v24.08",
"type": "u32",
"description": [
"which end of the first_scid is the start of the path"
]
},
"blinding": {
"added": "v24.08",
"type": "pubkey",
"description": [
"Blinding factor for this path."
]
},
"path": {
"type": "array",
"added": "v24.08",
"description": [
"An individual path."
],
"items": {
"type": "object",
"required": [
"blinded_node_id",
"encrypted_recipient_data"
],
"additionalProperties": false,
"properties": {
"blinded_node_id": {
"added": "v24.08",
"type": "pubkey",
"description": [
"Node_id of the hop."
]
},
"encrypted_recipient_data": {
"added": "v24.08",
"type": "hex",
"description": [
"Encrypted TLV entry for this hop."
]
}
}
}
}
}
}
},
"invreq_recurrence_counter": {
"type": "u32",
"description": [
Expand Down Expand Up @@ -7068,6 +7221,7 @@
"invreq_features": {},
"invreq_quantity": {},
"invreq_payer_note": {},
"invreq_paths": {},
"invreq_node_id": {},
"invreq_recurrence_counter": {},
"invreq_recurrence_start": {},
Expand Down
1,172 changes: 588 additions & 584 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,23 @@ def decode_invoice_paths2py(m):
})


def decode_invreq_paths_path2py(m):
return remove_default({
"blinded_node_id": hexlify(m.blinded_node_id), # PrimitiveField in generate_composite
"encrypted_recipient_data": hexlify(m.encrypted_recipient_data), # PrimitiveField in generate_composite
})


def decode_invreq_paths2py(m):
return remove_default({
"path": [decode_invreq_paths_path2py(i) for i in m.path], # ArrayField[composite] in generate_composite
"blinding": hexlify(m.blinding), # PrimitiveField in generate_composite
"first_node_id": hexlify(m.first_node_id), # PrimitiveField in generate_composite
"first_scid": m.first_scid, # PrimitiveField in generate_composite
"first_scid_dir": m.first_scid_dir, # PrimitiveField in generate_composite
})


def decode_offer_paths_path2py(m):
return remove_default({
"blinded_node_id": hexlify(m.blinded_node_id), # PrimitiveField in generate_composite
Expand Down Expand Up @@ -1238,6 +1255,7 @@ def decode2py(m):
"fallbacks": [decode_fallbacks2py(i) for i in m.fallbacks], # ArrayField[composite] in generate_composite
"invoice_fallbacks": [decode_invoice_fallbacks2py(i) for i in m.invoice_fallbacks], # ArrayField[composite] in generate_composite
"invoice_paths": [decode_invoice_paths2py(i) for i in m.invoice_paths], # ArrayField[composite] in generate_composite
"invreq_paths": [decode_invreq_paths2py(i) for i in m.invreq_paths], # ArrayField[composite] in generate_composite
"offer_chains": [hexlify(m.offer_chains) for i in hexlify(m.offer_chains)], # ArrayField[primitive] in generate_composite
"offer_paths": [decode_offer_paths2py(i) for i in m.offer_paths], # ArrayField[composite] in generate_composite
"restrictions": [decode_restrictions2py(i) for i in m.restrictions], # ArrayField[composite] in generate_composite
Expand Down
Loading

0 comments on commit f2a7b19

Please sign in to comment.