From 664b0c234eca5afec9a7de9c7533cbc41227af14 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 14 Dec 2018 22:50:25 +0100 Subject: [PATCH] wizard: fix imported address wallets assertion added in 9350709f13bc7e3d79b8e0f1515a3fdba4f2cbff was failing --- electrum/base_wizard.py | 2 +- electrum/commands.py | 2 +- electrum/wallet.py | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/electrum/base_wizard.py b/electrum/base_wizard.py index 838e6c4a6..da9cf9e3f 100644 --- a/electrum/base_wizard.py +++ b/electrum/base_wizard.py @@ -194,7 +194,7 @@ class BaseWizard(object): if keystore.is_address_list(text): w = Imported_Wallet(self.storage) addresses = text.split() - good_inputs, bad_inputs = w.import_addresses(addresses) + good_inputs, bad_inputs = w.import_addresses(addresses, write_to_disk=False) elif keystore.is_private_key_list(text): k = keystore.Imported_KeyStore({}) self.storage.put('keystore', k.dump()) diff --git a/electrum/commands.py b/electrum/commands.py index 41ec9e3d0..1ac6b306f 100644 --- a/electrum/commands.py +++ b/electrum/commands.py @@ -167,7 +167,7 @@ class Commands: if keystore.is_address_list(text): wallet = Imported_Wallet(storage) addresses = text.split() - good_inputs, bad_inputs = wallet.import_addresses(addresses) + good_inputs, bad_inputs = wallet.import_addresses(addresses, write_to_disk=False) # FIXME tell user about bad_inputs if not good_inputs: raise Exception("None of the given addresses can be imported") diff --git a/electrum/wallet.py b/electrum/wallet.py index 42e0ae9ec..6ac109290 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -1329,7 +1329,8 @@ class Imported_Wallet(Simple_Wallet): def get_change_addresses(self): return [] - def import_addresses(self, addresses: List[str]) -> Tuple[List[str], List[Tuple[str, str]]]: + def import_addresses(self, addresses: List[str], *, + write_to_disk=True) -> Tuple[List[str], List[Tuple[str, str]]]: good_addr = [] # type: List[str] bad_addr = [] # type: List[Tuple[str, str]] for address in addresses: @@ -1343,7 +1344,7 @@ class Imported_Wallet(Simple_Wallet): self.addresses[address] = {} self.add_address(address) self.save_addresses() - self.save_transactions(write=True) + self.save_transactions(write=write_to_disk) return good_addr, bad_addr def import_address(self, address: str) -> str: @@ -1408,7 +1409,7 @@ class Imported_Wallet(Simple_Wallet): def get_public_key(self, address): return self.addresses[address].get('pubkey') - def import_private_keys(self, keys: List[str], password: Optional[str], + def import_private_keys(self, keys: List[str], password: Optional[str], *, write_to_disk=True) -> Tuple[List[str], List[Tuple[str, str]]]: good_addr = [] # type: List[str] bad_keys = [] # type: List[Tuple[str, str]]