pyln.proto.message: add new BOLT12 fundamental types.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-07-30 21:22:35 +09:30 committed by Christian Decker
parent 85b4400d8d
commit c0eba75b1d
2 changed files with 15 additions and 0 deletions

View File

@ -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),
]

View File

@ -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()