mirror of
https://github.com/logos-blockchain/logos-blockchain-e2e-tests.git
synced 2026-01-02 13:13:08 +00:00
fix: add to_header_id conversion
This commit is contained in:
parent
a584d5e218
commit
c90328a5c3
@ -32,21 +32,28 @@ def generate_log_prefix():
|
||||
|
||||
|
||||
def to_index(n: int) -> list:
|
||||
if n < 0:
|
||||
raise ValueError("Input must be an unsigned integer (non-negative)")
|
||||
return list(n.to_bytes(8, byteorder="big"))
|
||||
return to_byte_list(n, 8)
|
||||
|
||||
|
||||
def to_app_id(n: int) -> list:
|
||||
if n < 0:
|
||||
raise ValueError("Input must be an unsigned integer (non-negative)")
|
||||
return list(n.to_bytes(32, byteorder="big"))
|
||||
return to_byte_list(n, 32)
|
||||
|
||||
|
||||
def to_blob_id(n: int) -> list:
|
||||
return to_byte_list(n, 32)
|
||||
|
||||
|
||||
def to_header_id(n: int) -> list:
|
||||
return to_byte_list(n, 32)
|
||||
|
||||
|
||||
def to_byte_list(n: int, l: int) -> list:
|
||||
if n < 0:
|
||||
raise ValueError("Input must be an unsigned integer (non-negative)")
|
||||
return list(n.to_bytes(32, byteorder="big"))
|
||||
if l < 1:
|
||||
raise ValueError("Length must be an unsigned integer greater than 0")
|
||||
|
||||
return list(n.to_bytes(l, byteorder="big"))
|
||||
|
||||
|
||||
def random_divide_k(n, k):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user