From 16c07561b56fec894765fa8940615d8b46ef6e40 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 3 Jun 2015 14:53:53 +0200 Subject: [PATCH] don't assign tx_api when not needed --- tests/common.py | 1 - trezorctl | 1 - trezorlib/client.py | 10 ++++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/common.py b/tests/common.py index 8d908bf3b4..bd2fe14725 100644 --- a/tests/common.py +++ b/tests/common.py @@ -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' diff --git a/trezorctl b/trezorctl index 74725464fb..995752fed8 100755 --- a/trezorctl +++ b/trezorctl @@ -442,7 +442,6 @@ def main(): else: client = TrezorClient(transport) - client.set_tx_api(TXAPIBitcoin()) cmds = Commands(client) res = args.func(cmds, args) diff --git a/trezorlib/client.py b/trezorlib/client.py index 8b60dd5336..5cb5916d46 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -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