Browse Source

pyln.proto.message: remove incorrect fundamental types now spec update.

See 9e8e29af9b

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
paymod-01
Rusty Russell 4 years ago
committed by Christian Decker
parent
commit
902d8f7dab
  1. 35
      contrib/pyln-proto/pyln/proto/message/fundamental_types.py
  2. 2
      contrib/pyln-proto/tests/test_fundamental_types.py
  3. 2
      contrib/pyln-proto/tests/test_message.py

35
contrib/pyln-proto/pyln/proto/message/fundamental_types.py

@ -250,7 +250,36 @@ class BigSizeType(FieldType):
def fundamental_types() -> List[FieldType]:
# From 01-messaging.md#fundamental-types:
# BOLT #1:
# Various fundamental types are referred to in the message specifications:
#
# * `byte`: an 8-bit byte
# * `u16`: a 2 byte unsigned integer
# * `u32`: a 4 byte unsigned integer
# * `u64`: an 8 byte unsigned integer
#
# Inside TLV records which contain a single value, leading zeros in
# integers can be omitted:
#
# * `tu16`: a 0 to 2 byte unsigned integer
# * `tu32`: a 0 to 4 byte unsigned integer
# * `tu64`: a 0 to 8 byte unsigned integer
#
# The following convenience types are also defined:
#
# * `chain_hash`: a 32-byte chain identifier (see [BOLT
# #0](00-introduction.md#glossary-and-terminology-guide))
# * `channel_id`: a 32-byte channel_id (see [BOLT
# #2](02-peer-protocol.md#definition-of-channel-id))
# * `sha256`: a 32-byte SHA2-256 hash
# * `signature`: a 64-byte bitcoin Elliptic Curve signature
# * `point`: a 33-byte Elliptic Curve point (compressed encoding as per
# [SEC 1 standard](http://www.secg.org/sec1-v2.pdf#subsubsection.2.3.3))
# * `short_channel_id`: an 8 byte value identifying a channel (see [BOLT
# #7](07-routing-gossip.md#definition-of-short-channel-id))
# * `bigsize`: a variable-length, unsigned integer similar to Bitcoin's
# CompactSize encoding, but big-endian. Described in
# [BigSize](#appendix-a-bigsize-test-vectors).
return [IntegerType('byte', 1, 'B'),
IntegerType('u16', 2, '>H'),
IntegerType('u32', 4, '>I'),
@ -265,10 +294,6 @@ def fundamental_types() -> List[FieldType]:
ShortChannelIDType('short_channel_id'),
FundamentalHexType('signature', 64),
BigSizeType('bigsize'),
# FIXME: See https://github.com/lightningnetwork/lightning-rfc/pull/778
BigSizeType('varint'),
# FIXME
IntegerType('u8', 1, 'B'),
]

2
contrib/pyln-proto/tests/test_fundamental_types.py

@ -74,4 +74,4 @@ def test_fundamental_types():
t.write(buf, v, None)
assert buf.getvalue() == test[1]
assert untested == set(['varint', 'u8'])
assert untested == set()

2
contrib/pyln-proto/tests/test_message.py

@ -140,7 +140,7 @@ def test_tlv_complex():
"msgdata,reply_channel_range,encoded_short_ids,byte,len",
"msgdata,reply_channel_range,tlvs,reply_channel_range_tlvs,",
"tlvtype,reply_channel_range_tlvs,timestamps_tlv,1",
"tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoding_type,u8,",
"tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoding_type,byte,",
"tlvdata,reply_channel_range_tlvs,timestamps_tlv,encoded_timestamps,byte,...",
"tlvtype,reply_channel_range_tlvs,checksums_tlv,3",
"tlvdata,reply_channel_range_tlvs,checksums_tlv,checksums,channel_update_checksums,...",

Loading…
Cancel
Save