Browse Source
wallet: handle exception when deleting last addr from imported wallet
fixes #6347
bip39-recovery
SomberNight
5 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
7 additions and
2 deletions
-
electrum/gui/qt/main_window.py
-
electrum/wallet.py
|
|
@ -1949,8 +1949,13 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): |
|
|
|
return self.create_list_tab(l) |
|
|
|
|
|
|
|
def remove_address(self, addr): |
|
|
|
if self.question(_("Do you want to remove {} from your wallet?").format(addr)): |
|
|
|
if not self.question(_("Do you want to remove {} from your wallet?").format(addr)): |
|
|
|
return |
|
|
|
try: |
|
|
|
self.wallet.delete_address(addr) |
|
|
|
except UserFacingException as e: |
|
|
|
self.show_error(str(e)) |
|
|
|
else: |
|
|
|
self.need_update.set() # history, addresses, coins |
|
|
|
self.clear_receive_tab() |
|
|
|
|
|
|
|
|
|
@ -2215,7 +2215,7 @@ class Imported_Wallet(Simple_Wallet): |
|
|
|
if not self.db.has_imported_address(address): |
|
|
|
return |
|
|
|
if len(self.get_addresses()) <= 1: |
|
|
|
raise Exception("cannot delete last remaining address from wallet") |
|
|
|
raise UserFacingException("cannot delete last remaining address from wallet") |
|
|
|
transactions_to_remove = set() # only referred to by this address |
|
|
|
transactions_new = set() # txs that are not only referred to by address |
|
|
|
with self.lock: |
|
|
|