1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-17 03:48:09 +00:00

don't assign tx_api when not needed

This commit is contained in:
Pavol Rusnak 2015-06-03 14:53:53 +02:00
parent 83b1b86f95
commit 16c07561b5
3 changed files with 8 additions and 4 deletions

View File

@ -11,7 +11,6 @@ class TrezorTest(unittest.TestCase):
self.client = TrezorDebugClient(self.transport)
self.client.set_debuglink(self.debug_transport)
# self.client.set_buttonwait(3)
self.client.set_tx_api(TXAPIBitcoin())
# 1 2 3 4 5 6 7 8 9 10 11 12
self.mnemonic12 = 'alcohol woman abuse must during monitor noble actual mixed trade anger aisle'

View File

@ -442,7 +442,6 @@ def main():
else:
client = TrezorClient(transport)
client.set_tx_api(TXAPIBitcoin())
cmds = Commands(client)
res = args.func(cmds, args)

View File

@ -538,7 +538,10 @@ class ProtocolMixin(object):
continue
tx = msg.transactions.add()
tx.CopyFrom(self.tx_api.get_tx(binascii.hexlify(inp.prev_hash)))
if self.tx_api:
tx.CopyFrom(self.tx_api.get_tx(binascii.hexlify(inp.prev_hash)))
else:
raise Exception('TX_API not defined')
known_hashes.append(inp.prev_hash)
return msg
@ -560,7 +563,10 @@ class ProtocolMixin(object):
if inp.prev_hash in known_hashes:
continue
txes[inp.prev_hash] = self.tx_api.get_tx(binascii.hexlify(inp.prev_hash))
if self.tx_api:
txes[inp.prev_hash] = self.tx_api.get_tx(binascii.hexlify(inp.prev_hash))
else:
raise Exception('TX_API not defined')
known_hashes.append(inp.prev_hash)
return txes