handle strings in tx inputs in test token cache tx object

This commit is contained in:
lash 2022-03-12 14:19:56 +00:00
parent e457275128
commit d5f19248da
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
1 changed files with 4 additions and 1 deletions

View File

@ -50,7 +50,10 @@ class MockCacheTokenTx(CacheTokenTx):
def deserialize(self, signed_tx):
h = hashlib.sha1()
h.update(signed_tx + b'\x01')
try:
h.update(signed_tx + b'\x01')
except TypeError:
h.update(signed_tx.encode('utf-8') + b'\x01')
z = h.digest()
nonce = int.from_bytes(z[:4], 'big')
token_value = int.from_bytes(z[4:8], 'big')