1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 10:58:21 +00:00

src/apps/wallet/sign_tx: make check for OMNI more strict

This commit is contained in:
Pavol Rusnak 2018-11-13 16:33:14 +01:00
parent 4693c071b4
commit 10a284f6ee
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,7 @@ currencies = {1: "OMNI", 2: "tOMNI", 3: "MAID", 31: "USDT"}
def is_valid(data: bytes) -> bool: def is_valid(data: bytes) -> bool:
return data[:4] == b"omni" return len(data) >= 8 and data[:4] == b"omni"
def parse(data: bytes) -> bool: def parse(data: bytes) -> bool:

View File

@ -6,7 +6,9 @@ class TestSignTxOmni(unittest.TestCase):
def test_is_valid(self): def test_is_valid(self):
VECTORS = { VECTORS = {
"6f6d6e69000000000000001f000000002b752ee0": True, "6f6d6e69": False,
"6f6d6e69000000": False,
"6f6d6e6900000000": True,
"6f6d6e69000000000000001f0000000020c85580": True, "6f6d6e69000000000000001f0000000020c85580": True,
"0f6d6e69000000000000001f0000000020c85580": False, "0f6d6e69000000000000001f0000000020c85580": False,
"6f6d6e69000000000000001f0000000020c8558000": True, "6f6d6e69000000000000001f0000000020c8558000": True,