mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 01:35:20 +00:00
Separate out get_input_tx.
This commit is contained in:
parent
9729f5b6d3
commit
b752e91dae
1 changed files with 12 additions and 7 deletions
|
@ -138,6 +138,17 @@ class TrezorCompatibleWallet(BIP44_Wallet):
|
||||||
msg_sig = client.sign_message('Bitcoin', address_n, message)
|
msg_sig = client.sign_message('Bitcoin', address_n, message)
|
||||||
return msg_sig.signature
|
return msg_sig.signature
|
||||||
|
|
||||||
|
def get_input_tx(self, tx_hash):
|
||||||
|
# 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)
|
||||||
|
if not tx:
|
||||||
|
request = ('blockchain.transaction.get', [tx_hash])
|
||||||
|
# FIXME: what if offline?
|
||||||
|
tx = Transaction(self.network.synchronous_get(request))
|
||||||
|
return tx
|
||||||
|
|
||||||
def sign_transaction(self, tx, password):
|
def sign_transaction(self, tx, password):
|
||||||
if tx.is_complete():
|
if tx.is_complete():
|
||||||
return
|
return
|
||||||
|
@ -147,13 +158,7 @@ class TrezorCompatibleWallet(BIP44_Wallet):
|
||||||
xpub_path = {}
|
xpub_path = {}
|
||||||
for txin in tx.inputs():
|
for txin in tx.inputs():
|
||||||
tx_hash = txin['prevout_hash']
|
tx_hash = txin['prevout_hash']
|
||||||
|
prev_tx[tx_hash] = self.get_input_tx(tx_hash)
|
||||||
ptx = self.transactions.get(tx_hash)
|
|
||||||
if ptx is None:
|
|
||||||
ptx = self.network.synchronous_get(('blockchain.transaction.get', [tx_hash]))
|
|
||||||
ptx = Transaction(ptx)
|
|
||||||
prev_tx[tx_hash] = ptx
|
|
||||||
|
|
||||||
for x_pubkey in txin['x_pubkeys']:
|
for x_pubkey in txin['x_pubkeys']:
|
||||||
if not is_extended_pubkey(x_pubkey):
|
if not is_extended_pubkey(x_pubkey):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Reference in a new issue