Page MenuHomePhabricator

[electrum] handle the password cancellation more gracefully
ClosedPublic

Authored by PiRK on Dec 22 2023, 16:53.

Details

Summary

When creating a proof from a coin selected in the Coins tab, the proof editor opens and immediately tries to add the coins to the proof. If the wallet is encrypted, the self.pwd
property of AvaProofEditor will pop up a password dialog. If that dialog is cancelled, the pwd property will be None which will cause some exotic Base58 decoding error to by shown to users when calling self.wallet.export_private_key(address, self.pwd).

So we need to exit early from add_utxos if the password is not available and show an error message that makes more sense..

Test Plan

With an encrypted wallet, select one or more coins in the coins tab, right click and "Build avalanche proof". Cancel the password dialog twice (the first time when the the dialog tries to suggest a master private key, the second time when the dialog tries again to get the password to get the coin's private keys).

A helpful error message is shown and the proof editor opens with neither master key nor stakes. Try again adding coins from this wallet in the proof editor, and get the same result if you cancel the password dialog again.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
fix_privkey_wallet_avaproof
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 26063
Build 51700: Build Diffelectrum-tests
Build 51699: arc lint + arc unit