Browse Source

plugins/bitbox02: fix compatibility with bitbox02-3.0.0

master
Marko Bencun 5 years ago
parent
commit
b863150fe3
No known key found for this signature in database GPG Key ID: 804538928C37EAE8
  1. 2
      contrib/requirements/requirements-hw.txt
  2. 34
      electrum/plugins/bitbox02/bitbox02.py

2
contrib/requirements/requirements-hw.txt

@ -13,5 +13,5 @@ safet>=0.1.5
keepkey>=6.3.1
btchip-python>=0.1.26
ckcc-protocol>=0.7.7
bitbox02>=2.0.2
bitbox02>=3.0.0
hidapi

34
electrum/plugins/bitbox02/bitbox02.py

@ -364,6 +364,32 @@ class BitBox02Client(HardwareClientBase):
"A wallet owned pubkey was not found in the transaction input to be signed"
)
prev_tx = wallet.db.get_transaction(txin.prevout.txid.hex())
if prev_tx is None:
raise Exception(
"Could not find transaction {} in db".format(txin.prevout.txid.hex()),
)
prev_inputs: List[bitbox02.BTCPrevTxInputType] = []
prev_outputs: List[bitbox02.BTCPrevTxOutputType] = []
for prev_txin in prev_tx.inputs():
prev_inputs.append(
{
"prev_out_hash": prev_txin.prevout.txid[::-1],
"prev_out_index": prev_txin.prevout.out_idx,
"signature_script": prev_txin.script_sig,
"sequence": prev_txin.nsequence,
}
)
for prev_txout in prev_tx.outputs():
prev_outputs.append(
{
"value": prev_txout.value,
"pubkey_script": prev_txout.scriptpubkey,
}
)
inputs.append(
{
"prev_out_hash": txin.prevout.txid[::-1],
@ -371,6 +397,12 @@ class BitBox02Client(HardwareClientBase):
"prev_out_value": txin.value_sats(),
"sequence": txin.nsequence,
"keypath": full_path,
"prev_tx": {
"version": prev_tx.version,
"locktime": prev_tx.locktime,
"inputs": prev_inputs,
"outputs": prev_outputs,
},
}
)
@ -536,7 +568,7 @@ class BitBox02_KeyStore(Hardware_KeyStore):
class BitBox02Plugin(HW_PluginBase):
keystore_class = BitBox02_KeyStore
minimum_library = (2, 0, 2)
minimum_library = (3, 0, 0)
DEVICE_IDS = [(0x03EB, 0x2403)]
SUPPORTED_XTYPES = ("p2wpkh-p2sh", "p2wpkh", "p2wsh")

Loading…
Cancel
Save