electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 664b0c234eca5afec9a7de9c7533cbc41227af14
parent 1e8b34e63e4d2b830237570207b847b161970924
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri, 14 Dec 2018 22:50:25 +0100

wizard: fix imported address wallets

assertion added in 9350709f13bc7e3d79b8e0f1515a3fdba4f2cbff was failing

Diffstat:
Melectrum/base_wizard.py | 2+-
Melectrum/commands.py | 2+-
Melectrum/wallet.py | 7++++---
3 files changed, 6 insertions(+), 5 deletions(-)

diff --git 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 @@ -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 @@ -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]]