|
@ -356,10 +356,17 @@ class Ledger_KeyStore(Hardware_KeyStore): |
|
|
self.give_error("No matching x_key for sign_transaction") # should never happen |
|
|
self.give_error("No matching x_key for sign_transaction") # should never happen |
|
|
|
|
|
|
|
|
redeemScript = Transaction.get_preimage_script(txin) |
|
|
redeemScript = Transaction.get_preimage_script(txin) |
|
|
if txin.get('prev_tx') is None: # and not Transaction.is_segwit_input(txin): |
|
|
txin_prev_tx = txin.get('prev_tx') |
|
|
# note: offline signing does not work atm even with segwit inputs for ledger |
|
|
if txin_prev_tx is None and not Transaction.is_segwit_input(txin): |
|
|
raise Exception(_('Offline signing with {} is not supported.').format(self.device)) |
|
|
raise Exception(_('Offline signing with {} is not supported for legacy inputs.').format(self.device)) |
|
|
inputs.append([txin['prev_tx'].raw, txin['prevout_n'], redeemScript, txin['prevout_hash'], signingPos, txin.get('sequence', 0xffffffff - 1) ]) |
|
|
txin_prev_tx_raw = txin_prev_tx.raw if txin_prev_tx else None |
|
|
|
|
|
inputs.append([txin_prev_tx_raw, |
|
|
|
|
|
txin['prevout_n'], |
|
|
|
|
|
redeemScript, |
|
|
|
|
|
txin['prevout_hash'], |
|
|
|
|
|
signingPos, |
|
|
|
|
|
txin.get('sequence', 0xffffffff - 1), |
|
|
|
|
|
txin.get('value')]) |
|
|
inputsPaths.append(hwAddress) |
|
|
inputsPaths.append(hwAddress) |
|
|
pubKeys.append(pubkeys) |
|
|
pubKeys.append(pubkeys) |
|
|
|
|
|
|
|
@ -401,10 +408,9 @@ class Ledger_KeyStore(Hardware_KeyStore): |
|
|
for utxo in inputs: |
|
|
for utxo in inputs: |
|
|
sequence = int_to_hex(utxo[5], 4) |
|
|
sequence = int_to_hex(utxo[5], 4) |
|
|
if segwitTransaction: |
|
|
if segwitTransaction: |
|
|
txtmp = bitcoinTransaction(bfh(utxo[0])) |
|
|
|
|
|
tmp = bfh(utxo[3])[::-1] |
|
|
tmp = bfh(utxo[3])[::-1] |
|
|
tmp += bfh(int_to_hex(utxo[1], 4)) |
|
|
tmp += bfh(int_to_hex(utxo[1], 4)) |
|
|
tmp += txtmp.outputs[utxo[1]].amount |
|
|
tmp += bfh(int_to_hex(utxo[6], 8)) # txin['value'] |
|
|
chipInputs.append({'value' : tmp, 'witness' : True, 'sequence' : sequence}) |
|
|
chipInputs.append({'value' : tmp, 'witness' : True, 'sequence' : sequence}) |
|
|
redeemScripts.append(bfh(utxo[2])) |
|
|
redeemScripts.append(bfh(utxo[2])) |
|
|
elif not p2shTransaction: |
|
|
elif not p2shTransaction: |
|
|