Browse Source

hw ledger: sign_transaction: add progress indicator

related: https://github.com/spesmilo/electrum/issues/7516
patch-4
SomberNight 3 years ago
parent
commit
ec98ef5aee
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      RELEASE-NOTES
  2. 10
      electrum/plugins/ledger/ledger.py

2
RELEASE-NOTES

@ -22,6 +22,8 @@
- during LN chan open, do not backup wallet automatically (#7733)
- Imported wallets: fix delete_address rm-ing too many txs (#7587)
- fix potential deadlock in wallet.py (d3476b6b)
* Hardware wallets:
- ledger: add progress indicator to sign_transaction (#7516)
* fix the "--portable" flag for AppImage, and for pip installs (#7732)

10
electrum/plugins/ledger/ledger.py

@ -444,10 +444,11 @@ class Ledger_KeyStore(Hardware_KeyStore):
else:
output = txout.address
self.handler.show_message(_("Confirm Transaction on your Ledger device..."))
try:
# Get trusted inputs from the original transactions
for utxo in inputs:
for input_idx, utxo in enumerate(inputs):
self.handler.show_message(_("Preparing transaction inputs...")
+ f" (phase1, {input_idx}/{len(inputs)})")
sequence = int_to_hex(utxo[5], 4)
if segwitTransaction and not client_electrum.supports_segwit_trustedInputs():
tmp = bfh(utxo[3])[::-1]
@ -472,6 +473,7 @@ class Ledger_KeyStore(Hardware_KeyStore):
chipInputs.append({'value' : tmp, 'sequence' : sequence})
redeemScripts.append(bfh(utxo[2]))
self.handler.show_message(_("Confirm Transaction on your Ledger device..."))
# Sign all inputs
firstTransaction = True
inputIndex = 0
@ -493,6 +495,8 @@ class Ledger_KeyStore(Hardware_KeyStore):
raise UserWarning()
self.handler.show_message(_("Confirmed. Signing Transaction..."))
while inputIndex < len(inputs):
self.handler.show_message(_("Signing transaction...")
+ f" (phase2, {inputIndex}/{len(inputs)})")
singleInput = [chipInputs[inputIndex]]
client_ledger.startUntrustedTransaction(False, 0,
singleInput, redeemScripts[inputIndex], version=tx.version)
@ -505,6 +509,8 @@ class Ledger_KeyStore(Hardware_KeyStore):
inputIndex = inputIndex + 1
else:
while inputIndex < len(inputs):
self.handler.show_message(_("Signing transaction...")
+ f" (phase2, {inputIndex}/{len(inputs)})")
client_ledger.startUntrustedTransaction(firstTransaction, inputIndex,
chipInputs, redeemScripts[inputIndex], version=tx.version)
# we don't set meaningful outputAddress, amount and fees

Loading…
Cancel
Save