mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
utf8: handle UTF-8 arrays.
BOLT 12 introduces this as a new fundamental type, which lets us easily validate them. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -204,6 +204,7 @@ class Type(FieldSet):
|
||||
'bool',
|
||||
'secp256k1_ecdsa_signature',
|
||||
'secp256k1_ecdsa_recoverable_signature',
|
||||
'utf8',
|
||||
'wirestring',
|
||||
'errcode_t',
|
||||
'bigsize',
|
||||
@@ -318,9 +319,10 @@ class Type(FieldSet):
|
||||
|
||||
return prefix + self.struct_name()
|
||||
|
||||
# We only accelerate the u8 case: it's common and trivial.
|
||||
# We accelerate the u8 case: it's common and trivial.
|
||||
# We handle the utf8 case so we can be sure it's actually a UTF-8 string.
|
||||
def has_array_helper(self):
|
||||
return self.name in ['u8']
|
||||
return self.name in ['u8', 'utf8']
|
||||
|
||||
def struct_name(self):
|
||||
if self.is_tlv():
|
||||
|
||||
Reference in New Issue
Block a user