trezor: segwit offline signing
This commit is contained in:
@@ -44,7 +44,7 @@ import sys
|
||||
|
||||
from .i18n import _
|
||||
from .util import (NotEnoughFunds, PrintError, UserCancelled, profiler,
|
||||
format_satoshis, NoDynamicFeeEstimates)
|
||||
format_satoshis, NoDynamicFeeEstimates, TimeoutException)
|
||||
|
||||
from .bitcoin import *
|
||||
from .version import *
|
||||
@@ -1401,21 +1401,28 @@ class Abstract_Wallet(PrintError):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_input_tx(self, tx_hash):
|
||||
def get_input_tx(self, tx_hash, ignore_timeout=False):
|
||||
# First look up an input transaction in the wallet where it
|
||||
# will likely be. If co-signing a transaction it may not have
|
||||
# all the input txs, in which case we ask the network.
|
||||
tx = self.transactions.get(tx_hash)
|
||||
tx = self.transactions.get(tx_hash, None)
|
||||
if not tx and self.network:
|
||||
request = ('blockchain.transaction.get', [tx_hash])
|
||||
tx = Transaction(self.network.synchronous_get(request))
|
||||
try:
|
||||
tx = Transaction(self.network.synchronous_get(request))
|
||||
except TimeoutException as e:
|
||||
self.print_error('getting input txn from network timed out for {}'.format(tx_hash))
|
||||
if not ignore_timeout:
|
||||
raise e
|
||||
return tx
|
||||
|
||||
def add_hw_info(self, tx):
|
||||
# add previous tx for hw wallets
|
||||
for txin in tx.inputs():
|
||||
tx_hash = txin['prevout_hash']
|
||||
txin['prev_tx'] = self.get_input_tx(tx_hash)
|
||||
# segwit inputs might not be needed for some hw wallets
|
||||
ignore_timeout = Transaction.is_segwit_input(txin)
|
||||
txin['prev_tx'] = self.get_input_tx(tx_hash, ignore_timeout)
|
||||
# add output info for hw wallets
|
||||
info = {}
|
||||
xpubs = self.get_master_public_keys()
|
||||
|
||||
Reference in New Issue
Block a user