Browse Source

wizard: fix imported address wallets

assertion added in 9350709f13 was failing
3.3.3.1
SomberNight 6 years ago
parent
commit
664b0c234e
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/base_wizard.py
  2. 2
      electrum/commands.py
  3. 7
      electrum/wallet.py

2
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())

2
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")

7
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]]

Loading…
Cancel
Save