mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 20:35:13 +00:00
fix ledger sign_transaction, issue #1938
This commit is contained in:
parent
f4e81a073a
commit
f26262da0f
1 changed files with 11 additions and 12 deletions
|
@ -257,28 +257,27 @@ class Ledger_KeyStore(Hardware_KeyStore):
|
||||||
p2shTransaction = False
|
p2shTransaction = False
|
||||||
pin = ""
|
pin = ""
|
||||||
self.get_client() # prompt for the PIN before displaying the dialog if necessary
|
self.get_client() # prompt for the PIN before displaying the dialog if necessary
|
||||||
rawTx = tx.serialize()
|
|
||||||
# Fetch inputs of the transaction to sign
|
# Fetch inputs of the transaction to sign
|
||||||
|
derivations = self.get_tx_derivations(tx)
|
||||||
for txin in tx.inputs():
|
for txin in tx.inputs():
|
||||||
if txin.get('is_coinbase'):
|
if txin.get('is_coinbase'):
|
||||||
self.give_error("Coinbase not supported") # should never happen
|
self.give_error("Coinbase not supported") # should never happen
|
||||||
redeemScript = None
|
redeemScript = None
|
||||||
signingPos = -1
|
|
||||||
xpub, s = parse_xpubkey(txin['x_pubkeys'][0])
|
|
||||||
hwAddress = "%s/%d/%d" % (self.get_derivation()[2:], s[0], s[1])
|
|
||||||
|
|
||||||
if len(txin['pubkeys']) > 1:
|
if len(txin['pubkeys']) > 1:
|
||||||
p2shTransaction = True
|
p2shTransaction = True
|
||||||
if 'redeemScript' in txin:
|
if 'redeemScript' in txin:
|
||||||
redeemScript = txin['redeemScript']
|
redeemScript = txin['redeemScript']
|
||||||
if p2shTransaction:
|
|
||||||
chipPublicKey = compress_public_key(self.get_client().getWalletPublicKey(hwAddress)['publicKey'])
|
for i, x_pubkey in enumerate(txin['x_pubkeys']):
|
||||||
for currentIndex, key in enumerate(txin['pubkeys']):
|
if x_pubkey in derivations:
|
||||||
if chipPublicKey == key.decode('hex'):
|
signingPos = i
|
||||||
signingPos = currentIndex
|
s = derivations.get(x_pubkey)
|
||||||
break
|
hwAddress = "%s/%d/%d" % (self.get_derivation()[2:], s[0], s[1])
|
||||||
if signingPos == -1:
|
break
|
||||||
self.give_error("No matching key for multisignature input") # should never happen
|
else:
|
||||||
|
self.give_error("No matching x_key for sign_transaction") # should never happen
|
||||||
|
|
||||||
inputs.append([txin['prev_tx'].raw, txin['prevout_n'], redeemScript, txin['prevout_hash'], signingPos ])
|
inputs.append([txin['prev_tx'].raw, txin['prevout_n'], redeemScript, txin['prevout_hash'], signingPos ])
|
||||||
inputsPaths.append(hwAddress)
|
inputsPaths.append(hwAddress)
|
||||||
|
|
Loading…
Add table
Reference in a new issue