From 54bc7239ce01cea9e248b49d401c4f83e6b486ef Mon Sep 17 00:00:00 2001 From: slush0 Date: Fri, 18 Apr 2014 18:56:12 +0200 Subject: [PATCH] Adde debug_processor to sign_tx() for unittest purposes --- trezorlib/client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/trezorlib/client.py b/trezorlib/client.py index 783d4e4..807fc4b 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -455,7 +455,7 @@ class ProtocolMixin(object): return txes - def sign_tx(self, coin_name, inputs, outputs): + def sign_tx(self, coin_name, inputs, outputs, debug_processor=None): start = time.time() txes = self._prepare_sign_tx(coin_name, inputs, outputs) @@ -525,6 +525,13 @@ class ProtocolMixin(object): msg.bin_outputs.extend([current_tx.bin_outputs[res.details.request_index], ]) else: msg.outputs.extend([current_tx.outputs[res.details.request_index], ]) + + if debug_processor != None: + # If debug_processor function is provided, + # pass thru it the request and prepared response. + # This is useful for unit tests, see test_msg_signtx + msg = debug_processor(res, msg) + res = self.call(proto.TxAck(tx=msg)) continue