mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-19 21:08:07 +00:00
src/apps/wallet: add asserts to sign_tx.writers
This commit is contained in:
parent
f6be3899eb
commit
6d21723330
@ -33,6 +33,7 @@ def write_tx_output(w, o: TxOutputBinType):
|
||||
|
||||
|
||||
def write_op_push(w, n: int):
|
||||
assert n >= 0 and n <= 4294967295
|
||||
if n < 0x4C:
|
||||
w.append(n & 0xFF)
|
||||
elif n < 0xFF:
|
||||
@ -55,6 +56,7 @@ def write_op_push(w, n: int):
|
||||
|
||||
|
||||
def write_varint(w, n: int):
|
||||
assert n >= 0 and n <= 4294967295
|
||||
if n < 253:
|
||||
w.append(n & 0xFF)
|
||||
elif n < 65536:
|
||||
@ -70,6 +72,7 @@ def write_varint(w, n: int):
|
||||
|
||||
|
||||
def write_uint32(w, n: int):
|
||||
assert n >= 0 and n <= 4294967295
|
||||
w.append(n & 0xFF)
|
||||
w.append((n >> 8) & 0xFF)
|
||||
w.append((n >> 16) & 0xFF)
|
||||
@ -77,6 +80,7 @@ def write_uint32(w, n: int):
|
||||
|
||||
|
||||
def write_uint64(w, n: int):
|
||||
assert n >= 0 and n <= 18446744073709551615
|
||||
w.append(n & 0xFF)
|
||||
w.append((n >> 8) & 0xFF)
|
||||
w.append((n >> 16) & 0xFF)
|
||||
|
Loading…
Reference in New Issue
Block a user