replace tx.input, tx.output by methods, so that deserialize calls are encapsulated
This commit is contained in:
@@ -200,9 +200,9 @@ class BTChipWallet(BIP44_Wallet):
|
||||
pubKeys.append(self.get_public_keys(address))
|
||||
|
||||
# Recognize outputs - only one output and one change is authorized
|
||||
if len(tx.outputs) > 2: # should never happen
|
||||
if len(tx.outputs()) > 2: # should never happen
|
||||
self.give_error("Transaction with more than 2 outputs not supported")
|
||||
for type, address, amount in tx.outputs:
|
||||
for type, address, amount in tx.outputs():
|
||||
assert type == TYPE_ADDRESS
|
||||
if self.is_change(address):
|
||||
changePath = self.address_id(address)
|
||||
|
||||
@@ -365,7 +365,7 @@ class TrezorCompatiblePlugin(BasePlugin, ThreadJob):
|
||||
|
||||
def tx_inputs(self, tx, for_sig=False):
|
||||
inputs = []
|
||||
for txin in tx.inputs:
|
||||
for txin in tx.inputs():
|
||||
txinputtype = self.types.TxInputType()
|
||||
if txin.get('is_coinbase'):
|
||||
prev_hash = "\0"*32
|
||||
@@ -426,8 +426,7 @@ class TrezorCompatiblePlugin(BasePlugin, ThreadJob):
|
||||
|
||||
def tx_outputs(self, wallet, tx):
|
||||
outputs = []
|
||||
|
||||
for type, address, amount in tx.outputs:
|
||||
for type, address, amount in tx.outputs():
|
||||
assert type == TYPE_ADDRESS
|
||||
txoutputtype = self.types.TxOutputType()
|
||||
if wallet.is_change(address):
|
||||
@@ -464,7 +463,6 @@ class TrezorCompatiblePlugin(BasePlugin, ThreadJob):
|
||||
# This function is called from the trezor libraries (via tx_api)
|
||||
def get_tx(self, tx_hash):
|
||||
tx = self.prev_tx[tx_hash]
|
||||
tx.deserialize()
|
||||
return self.electrum_tx_to_txtype(tx)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user