From c0eba75b1d0f7ee4305ab03e48c592fa62da59eb Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 30 Jul 2021 21:22:35 +0930 Subject: [PATCH] pyln.proto.message: add new BOLT12 fundamental types. Signed-off-by: Rusty Russell --- .../pyln/proto/message/fundamental_types.py | 4 ++++ contrib/pyln-proto/tests/test_fundamental_types.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/contrib/pyln-proto/pyln/proto/message/fundamental_types.py b/contrib/pyln-proto/pyln/proto/message/fundamental_types.py index 2d3baea34..ac807e5e9 100644 --- a/contrib/pyln-proto/pyln/proto/message/fundamental_types.py +++ b/contrib/pyln-proto/pyln/proto/message/fundamental_types.py @@ -294,6 +294,10 @@ def fundamental_types() -> List[FieldType]: ShortChannelIDType('short_channel_id'), FundamentalHexType('signature', 64), BigSizeType('bigsize'), + # Extra types added in offers draft: + IntegerType('utf8', 1, 'B'), + FundamentalHexType('bip340sig', 64), + FundamentalHexType('point32', 32), ] diff --git a/contrib/pyln-proto/tests/test_fundamental_types.py b/contrib/pyln-proto/tests/test_fundamental_types.py index dbd03c988..85e98d810 100644 --- a/contrib/pyln-proto/tests/test_fundamental_types.py +++ b/contrib/pyln-proto/tests/test_fundamental_types.py @@ -58,6 +58,17 @@ def test_fundamental_types(): ['65536', bytes([254, 0, 1, 0, 0])], ['4294967295', bytes([254, 255, 255, 255, 255])], ['4294967296', bytes([255, 0, 0, 0, 1, 0, 0, 0, 0])]], + 'utf8': [['97', b'\x61'], + ['0', b'\x00']], + 'bip340sig': [['0102030405060708090a0b0c0d0e0f10' + '1112131415161718191a1b1c1d1e1f20' + '2122232425262728292a2b2c2d2e2f30' + '3132333435363738393a3b3c3d3e3f40', + bytes(range(1, 65))]], + 'point32': [['02030405060708090a0b0c0d0e0f10' + '1112131415161718191a1b1c1d1e1f20' + '21', + bytes(range(2, 34))]], } untested = set()