don't assign tx_api when not needed

pull/1/head
Pavol Rusnak 9 years ago
parent 83b1b86f95
commit 16c07561b5

@ -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'

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

@ -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

Loading…
Cancel
Save