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

@@ -193,7 +193,7 @@ def send_onion_message_to(
if len(node_id_or_blinded_path) > 33: # assume blinded path
with io.BytesIO(node_id_or_blinded_path) as blinded_path_fd:
try:
blinded_path = OnionWireSerializer._read_complex_field(
blinded_path = OnionWireSerializer.read_field(
fd=blinded_path_fd,
field_type='blinded_path',
count=1)