1
0

update field naming for BOLT04 structures

see also: 3fffab3b88
This commit is contained in:
Sander van Grieken
2025-11-10 13:28:36 +01:00
parent d87f9e9a44
commit 130af59760
5 changed files with 52 additions and 52 deletions

View File

@@ -6,12 +6,12 @@
"hops": [
{
"alias": "Alice",
"comment": "Alice->Bob: note next_blinding_override to match that give by Dave for Bob",
"blinding_secret": "6363636363636363636363636363636363636363636363636363636363636363",
"comment": "Alice->Bob: note next_path_key_override to match that give by Dave for Bob",
"path_key_secret": "6363636363636363636363636363636363636363636363636363636363636363",
"tlvs": {
"next_node_id": "0324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c",
"next_blinding_override": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"blinding_override_secret": "0101010101010101010101010101010101010101010101010101010101010101"
"next_path_key_override": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"path_key_override_secret": "0101010101010101010101010101010101010101010101010101010101010101"
},
"encrypted_data_tlv": "04210324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c0821031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
"ss": "c04d2a4c518241cb49f2800eea92554cb543f268b4c73f85693541e86d649205",
@@ -26,7 +26,7 @@
{
"alias": "Bob",
"comment": "Bob->Carol",
"blinding_secret": "0101010101010101010101010101010101010101010101010101010101010101",
"path_key_secret": "0101010101010101010101010101010101010101010101010101010101010101",
"tlvs": {
"next_node_id": "027f31ebc5462c1fdce1b737ecff52d37d75dea43ce11c74d25aa297165faa2007",
"unknown_tag_561": "123456"
@@ -44,7 +44,7 @@
{
"alias": "Carol",
"comment": "Carol->Dave",
"blinding_secret": "f7ab6dca6152f7b6b0c9d7c82d716af063d72d8eef8816dfc51a8ae828fa7dce",
"path_key_secret": "f7ab6dca6152f7b6b0c9d7c82d716af063d72d8eef8816dfc51a8ae828fa7dce",
"tlvs": {
"padding": "0000000000",
"next_node_id": "032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"
@@ -62,7 +62,7 @@
{
"alias": "Dave",
"comment": "Dave is final node, hence path_id",
"blinding_secret": "5de52bb427cc148bf23e509fdc18012004202517e80abcfde21612ae408e6cea",
"path_key_secret": "5de52bb427cc148bf23e509fdc18012004202517e80abcfde21612ae408e6cea",
"tlvs": {
"padding": "",
"path_id": "deadbeefbadc0ffeedeadbeefbadc0ffeedeadbeefbadc0ffeedeadbeefbadc0",
@@ -82,8 +82,8 @@
},
"route": {
"comment": "The resulting blinded route Alice to Dave.",
"introduction_node_id": "02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619",
"blinding": "031195a8046dcbb8e17034bca630065e7a0982e4e36f6f7e5a8d4554e4846fcd99",
"first_node_id": "02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619",
"first_path_key": "031195a8046dcbb8e17034bca630065e7a0982e4e36f6f7e5a8d4554e4846fcd99",
"hops": [
{
"blinded_node_id": "02d1c3d73f8cac67e7c5b6ec517282d5ba0a52b06a29ec92ff01e12decf76003c1",

View File

@@ -44,13 +44,13 @@ BOB_TLVS = HOPS[1]['tlvs']
CAROL_TLVS = HOPS[2]['tlvs']
DAVE_TLVS = HOPS[3]['tlvs']
ALICE_PUBKEY = bfh(test_vectors['route']['introduction_node_id'])
ALICE_PUBKEY = bfh(test_vectors['route']['first_node_id'])
BOB_PUBKEY = bfh(ALICE_TLVS['next_node_id'])
CAROL_PUBKEY = bfh(BOB_TLVS['next_node_id'])
DAVE_PUBKEY = bfh(CAROL_TLVS['next_node_id'])
BLINDING_SECRET = bfh(HOPS[0]['blinding_secret'])
BLINDING_OVERRIDE_SECRET = bfh(ALICE_TLVS['blinding_override_secret'])
BLINDING_SECRET = bfh(HOPS[0]['path_key_secret'])
BLINDING_OVERRIDE_SECRET = bfh(ALICE_TLVS['path_key_override_secret'])
SESSION_KEY = bfh(test_vectors['generate']['session_key'])
@@ -74,7 +74,7 @@ class TestOnionMessage(ElectrumTestCase):
tlv_stream_name='onionmsg_tlv',
blind_fields={
'next_node_id': {'node_id': bfh(ALICE_TLVS['next_node_id'])},
'next_blinding_override': {'blinding': bfh(ALICE_TLVS['next_blinding_override'])},
'next_path_key_override': {'path_key': bfh(ALICE_TLVS['next_path_key_override'])},
}
),
OnionHopsDataSingle(
@@ -150,7 +150,7 @@ class TestOnionMessage(ElectrumTestCase):
msgtype, data = decode_msg(bfh(msg))
self.assertEqual(msgtype, 'onion_message')
self.assertEqual(data, {
'blinding': bfh(test_vectors['route']['blinding']),
'path_key': bfh(test_vectors['route']['first_path_key']),
'len': 1366,
'onion_message_packet': ONION_MESSAGE_PACKET,
})
@@ -158,7 +158,7 @@ class TestOnionMessage(ElectrumTestCase):
def test_decrypt_onion_message(self):
o = OnionPacket.from_bytes(ONION_MESSAGE_PACKET)
our_privkey = bfh(test_vectors['decrypt']['hops'][0]['privkey'])
blinding = bfh(test_vectors['route']['blinding'])
blinding = bfh(test_vectors['route']['first_path_key'])
shared_secret = get_ecdh(our_privkey, blinding)
b_hmac = get_bolt04_onion_key(b'blinded_node_id', shared_secret)
@@ -179,7 +179,7 @@ class TestOnionMessage(ElectrumTestCase):
msgtype, data = decode_msg(bfh(onion_message_bob))
self.assertEqual(msgtype, 'onion_message')
self.assertEqual(data, {
'blinding': bfh(ALICE_TLVS['next_blinding_override']),
'path_key': bfh(ALICE_TLVS['next_path_key_override']),
'len': 1366,
'onion_message_packet': p.next_packet.to_bytes(),
})
@@ -196,7 +196,7 @@ class TestOnionMessage(ElectrumTestCase):
rp = create_blinded_path(session_key, [pubkey], final_recipient_data)
self.assertEqual(pubkey, rp['first_node_id'])
self.assertEqual(bfh('022ed557f5ad336b31a49857e4e9664954ac33385aa20a93e2d64bfe7f08f51277'), rp['blinding'])
self.assertEqual(bfh('022ed557f5ad336b31a49857e4e9664954ac33385aa20a93e2d64bfe7f08f51277'), rp['first_path_key'])
self.assertEqual(1, rp['num_hops'])
self.assertEqual([{
'blinded_node_id': bfh('031e5d91e6c417f6e8c16d1086db1887edef7be9334f5e744d04edb8da7507481e'),
@@ -234,7 +234,7 @@ class TestOnionMessage(ElectrumTestCase):
tlv_stream_name='onionmsg_tlv',
blind_fields={
'next_node_id': {'node_id': BOB_PUBKEY},
'next_blinding_override': {'blinding': bfh(ALICE_TLVS['next_blinding_override'])},
'next_path_key_override': {'path_key': bfh(ALICE_TLVS['next_path_key_override'])},
}
),
]
@@ -434,7 +434,7 @@ class TestOnionMessageManager(ElectrumTestCase):
onionmsg = bfh(test_vectors['onionmessage']['onion_message_packet'])
try:
t.on_onion_message({
'blinding': bfh(test_vectors['route']['blinding']),
'blinding': bfh(test_vectors['route']['first_path_key']),
'len': len(onionmsg),
'onion_message_packet': onionmsg
})