MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_decryptencrypteddata

Function test_decryptencrypteddata

tests/test_pay.py:6103–6129  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

6101
6102
6103def test_decryptencrypteddata(node_factory):
6104 l1, l2, l3 = node_factory.line_graph(3, fundchannel=False)
6105
6106 # Private channel from l2->l3, makes l3 add a blinded path to invoice
6107 # (l1's existence makes sure l3 doesn't see l2 as a dead end!)
6108 node_factory.join_nodes([l1, l2], wait_for_announce=True)
6109 node_factory.join_nodes([l2, l3], announce_channels=False)
6110 wait_for(lambda: ['alias' in n for n in l3.rpc.listnodes()['nodes']] == [True, True])
6111
6112 offer = l3.rpc.offer(amount='2msat', description='test_offer_path_self')
6113 inv = l2.rpc.fetchinvoice(offer['bolt12'])['invoice']
6114
6115 decode = l2.rpc.decode(inv)
6116 path = decode['invoice_paths'][0]
6117 assert path['first_node_id'] == l2.info['id']
6118 first_path_key = path['first_path_key']
6119
6120 encdata1 = path['path'][0]['encrypted_recipient_data']
6121 # BOLT #4:
6122 # 1. `tlv_stream`: `encrypted_data_tlv`
6123 # 2. types:
6124 # ...
6125 # 1. type: 4 (`next_node_id`)
6126 # 2. data:
6127 # * [`point`:`node_id`]
6128 dec = l2.rpc.decryptencrypteddata(encrypted_data=encdata1, path_key=first_path_key)['decryptencrypteddata']
6129 assert dec['decrypted'].startswith('0421' + l3.info['id'])
6130
6131
6132def test_offer_experimental_fields(node_factory):

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
line_graphMethod · 0.80
join_nodesMethod · 0.80
fetchinvoiceMethod · 0.80
listnodesMethod · 0.45
offerMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected