From db5cf22ff485c4c1ee2e80580cb5dbec1759866e Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 4 Jun 2020 19:41:34 +0200 Subject: [PATCH] bitbox02: get prev tx from psbt instead of wallet db - for symmetry with other plugins - and because this is a superset. txin.utxo gets populated from the wallet db (or network); but the wallet db does not import txs from txin.utxo (so if a psbt already had an unknown tx there, it will not get imported) --- electrum/plugins/bitbox02/bitbox02.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/electrum/plugins/bitbox02/bitbox02.py b/electrum/plugins/bitbox02/bitbox02.py index fa6a57a12..da9c86ee2 100644 --- a/electrum/plugins/bitbox02/bitbox02.py +++ b/electrum/plugins/bitbox02/bitbox02.py @@ -357,19 +357,16 @@ class BitBox02Client(HardwareClientBase): # Build BTCInputType list inputs = [] for txin in tx.inputs(): - _, full_path = keystore.find_my_pubkey_in_txinout(txin) + my_pubkey, full_path = keystore.find_my_pubkey_in_txinout(txin) if full_path is None: raise Exception( "A wallet owned pubkey was not found in the transaction input to be signed" ) - prev_tx = wallet.db.get_transaction(txin.prevout.txid.hex()) + prev_tx = txin.utxo if prev_tx is None: - raise Exception( - "Could not find transaction {} in db".format(txin.prevout.txid.hex()), - ) - + raise UserFacingException(_('Missing previous tx.')) prev_inputs: List[bitbox02.BTCPrevTxInputType] = [] prev_outputs: List[bitbox02.BTCPrevTxOutputType] = [] @@ -437,7 +434,7 @@ class BitBox02Client(HardwareClientBase): assert txout.address # check for change if txout.is_change: - _, change_pubkey_path = keystore.find_my_pubkey_in_txinout(txout) + my_pubkey, change_pubkey_path = keystore.find_my_pubkey_in_txinout(txout) outputs.append( bitbox02.BTCOutputInternal( keypath=change_pubkey_path, value=txout.value,