From dc0d7fd1d60399d08d224ad1a184410a04c80080 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 27 Mar 2014 19:10:24 +0100 Subject: [PATCH] initialize version/lock_time in TransactionType --- tests/config.py | 4 ++-- tests/test_msg_simplesigntx.py | 4 +++- trezorlib/api_blockchain.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/config.py b/tests/config.py index 9ff6e75..3fc402f 100644 --- a/tests/config.py +++ b/tests/config.py @@ -27,8 +27,8 @@ if len(devices) > 0: else: print 'Using Emulator' TRANSPORT = PipeTransport - TRANSPORT_ARGS = ('../../trezor-emu/pipe.trezor', False) + TRANSPORT_ARGS = ('/tmp/pipe.trezor', False) TRANSPORT_KWARGS = {} DEBUG_TRANSPORT = PipeTransport - DEBUG_TRANSPORT_ARGS = ('../../trezor-emu/pipe.trezor_debug', False) + DEBUG_TRANSPORT_ARGS = ('/tmp/pipe.trezor_debug', False) DEBUG_TRANSPORT_KWARGS = {} diff --git a/tests/test_msg_simplesigntx.py b/tests/test_msg_simplesigntx.py index d8b906c..8bc4871 100644 --- a/tests/test_msg_simplesigntx.py +++ b/tests/test_msg_simplesigntx.py @@ -14,7 +14,7 @@ class FakeTestnetBlockchain(object): if txhash != '6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54': raise Exception("Unexpected hash") - t = proto_types.TransactionType(version = 1, lock_time = 0) + t = proto_types.TransactionType() i = t.inputs.add() i.prev_hash = binascii.unhexlify('ee336e79153d51f4f3e45278f1f77ab29fd5bb135dce467282e2aff22cb9c570') @@ -34,6 +34,8 @@ class FakeTestnetBlockchain(object): o.amount = 1000000000 o.script_pubkey = binascii.unhexlify('76a91424a56db43cf6f2b02e838ea493f95d8d6047423188ac') + t.version = 1 + t.lock_time = 0 return t class TestMsgSimplesigntx(common.TrezorTest): diff --git a/trezorlib/api_blockchain.py b/trezorlib/api_blockchain.py index cc4e0b9..8c65c8c 100644 --- a/trezorlib/api_blockchain.py +++ b/trezorlib/api_blockchain.py @@ -30,7 +30,7 @@ class BlockchainApi(object): def get_tx(self, txhash): # Build protobuf transaction structure from blockchain.info d = self._raw_tx(txhash) - t = proto_types.TransactionType(version = 1, lock_time = 0) + t = proto_types.TransactionType() for inp in d['inputs']: di = self._raw_tx(inp['prev_out']['tx_index']) @@ -44,6 +44,8 @@ class BlockchainApi(object): o.amount = output['value'] o.script_pubkey = binascii.unhexlify(output['script']) + t.version = 1 + t.lock_time = 0 return t if __name__ == '__main__':