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

Function test_createonion_rpc

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

Source from the content-addressed store, hash-verified

2963
2964
2965def test_createonion_rpc(node_factory):
2966 l1 = node_factory.get_node()
2967
2968 # From bolt04/onion-test.json:
2969 hops = [{
2970 "pubkey": "02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619",
2971 "payload": "1202023a98040205dc06080000000000000001"
2972 }, {
2973 "pubkey": "0324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c",
2974 "payload": "52020236b00402057806080000000000000002fd02013c0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f"
2975 }, {
2976 "pubkey": "027f31ebc5462c1fdce1b737ecff52d37d75dea43ce11c74d25aa297165faa2007",
2977 "payload": "12020230d4040204e206080000000000000003"
2978 }, {
2979 "pubkey": "032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
2980 "payload": "1202022710040203e806080000000000000004"
2981 }, {
2982 "pubkey": "02edabbd16b41c8371b92ef2f04c1185b4f03b6dcd52ba9b78d9d7c89c8f221145",
2983 "payload": "fd011002022710040203e8082224a33562c54507a9334e79f0dc4f17d407e6d7c61f0e2f3d0d38599502f617042710fd012de02a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a"
2984 }]
2985
2986 res = l1.rpc.createonion(hops=hops, assocdata="BB" * 32)
2987 assert(len(res['onion']) == 2 * 1366)
2988 assert(len(res['shared_secrets']) == len(hops))
2989
2990 res = l1.rpc.createonion(hops=hops, assocdata="42" * 32,
2991 session_key="41" * 32)
2992 # The trailer is generated using the filler and can be ued as a
2993 # checksum. This trailer is from the test-vector in the specs.
2994 assert(res['onion'].endswith('9126aaefb627719f421e20'))
2995
2996
2997def test_sendonion_rpc(node_factory):

Callers

nothing calls this directly

Calls 1

get_nodeMethod · 0.45

Tested by

no test coverage detected