mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
bolt-gen: add truncated uint support for TLV fields
TLV's have truncated values, add support for them. plus some 'compilation' tests.
This commit is contained in:
committed by
Rusty Russell
parent
4261e508a9
commit
cedebfd2d9
@@ -153,10 +153,12 @@ class Type(FieldSet):
|
||||
'u16',
|
||||
'u32',
|
||||
'u64',
|
||||
'tu16',
|
||||
'tu32',
|
||||
'tu64',
|
||||
'bool',
|
||||
'amount_sat',
|
||||
'amount_msat',
|
||||
# FIXME: omits var_int
|
||||
]
|
||||
|
||||
typedefs = [
|
||||
@@ -168,6 +170,12 @@ class Type(FieldSet):
|
||||
'secp256k1_ecdsa_signature',
|
||||
]
|
||||
|
||||
truncated_typedefs = [
|
||||
'tu16',
|
||||
'tu32',
|
||||
'tu64',
|
||||
]
|
||||
|
||||
# Externally defined variable size types (require a context)
|
||||
varsize_types = [
|
||||
'peer_features',
|
||||
@@ -238,6 +246,8 @@ class Type(FieldSet):
|
||||
def type_name(self):
|
||||
if self.name in self.typedefs:
|
||||
return self.name
|
||||
if self.name in self.truncated_typedefs:
|
||||
return self.name[1:]
|
||||
if self.is_enum:
|
||||
prefix = 'enum '
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user