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)
This commit is contained in:
@@ -357,19 +357,16 @@ class BitBox02Client(HardwareClientBase):
|
|||||||
# Build BTCInputType list
|
# Build BTCInputType list
|
||||||
inputs = []
|
inputs = []
|
||||||
for txin in tx.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:
|
if full_path is None:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"A wallet owned pubkey was not found in the transaction input to be signed"
|
"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:
|
if prev_tx is None:
|
||||||
raise Exception(
|
raise UserFacingException(_('Missing previous tx.'))
|
||||||
"Could not find transaction {} in db".format(txin.prevout.txid.hex()),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
prev_inputs: List[bitbox02.BTCPrevTxInputType] = []
|
prev_inputs: List[bitbox02.BTCPrevTxInputType] = []
|
||||||
prev_outputs: List[bitbox02.BTCPrevTxOutputType] = []
|
prev_outputs: List[bitbox02.BTCPrevTxOutputType] = []
|
||||||
@@ -437,7 +434,7 @@ class BitBox02Client(HardwareClientBase):
|
|||||||
assert txout.address
|
assert txout.address
|
||||||
# check for change
|
# check for change
|
||||||
if txout.is_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(
|
outputs.append(
|
||||||
bitbox02.BTCOutputInternal(
|
bitbox02.BTCOutputInternal(
|
||||||
keypath=change_pubkey_path, value=txout.value,
|
keypath=change_pubkey_path, value=txout.value,
|
||||||
|
|||||||
Reference in New Issue
Block a user