1
0

lnmsg: support both primitive and complex types (subtypes) in LNSerializer.

This renames lnmsg._{read,write}_field to lnmsg._{read,write}_primitive_field, renames
LNSerializer._{read,write}_complex_type to LNSerializer.{read,write}_field and allows
LNSerializer.{read,write}_field to handle both primitive and complex types.

Also makes these funcs public, as these encodings are used outside of lnmsg as well
(e.g. encoding blinded paths in BOLT12 invoice_request)
This commit is contained in:
Sander van Grieken
2025-02-12 14:28:30 +01:00
parent e216f1b324
commit 6e35ffe4b5
4 changed files with 69 additions and 71 deletions

View File

@@ -194,7 +194,7 @@ class TestOnionMessage(ElectrumTestCase):
# TODO: serialization test to test_lnmsg.py
with io.BytesIO() as blinded_path_fd:
OnionWireSerializer._write_complex_field(
OnionWireSerializer.write_field(
fd=blinded_path_fd,
field_type='blinded_path',
count=1,