Sweep keys: don't default to hidden address
The issue is electrum uses None as the current account to mean the default account. This just gave rise to all addresses being listed including in hidden accounts. Really "None" as used in main_window.py and history_widget.py means "a single unspecified account" not "all accounts". So implement the idea of a default account, and don't let a hidden account be the default one.
This commit is contained in:
parent
38a8385287
commit
605cc47a3d
|
@ -666,10 +666,13 @@ class Abstract_Wallet(PrintError):
|
||||||
amount = max(0, sendable - fee)
|
amount = max(0, sendable - fee)
|
||||||
return amount, fee
|
return amount, fee
|
||||||
|
|
||||||
|
def default_account_id(self):
|
||||||
|
return self.accounts.keys()[0]
|
||||||
|
|
||||||
def get_account_addresses(self, acc_id, include_change=True):
|
def get_account_addresses(self, acc_id, include_change=True):
|
||||||
if acc_id is None:
|
if acc_id is None:
|
||||||
addr_list = self.addresses(include_change)
|
acc_id = self.default_account_id()
|
||||||
elif acc_id in self.accounts:
|
if acc_id in self.accounts:
|
||||||
acc = self.accounts[acc_id]
|
acc = self.accounts[acc_id]
|
||||||
addr_list = acc.get_addresses(0)
|
addr_list = acc.get_addresses(0)
|
||||||
if include_change:
|
if include_change:
|
||||||
|
@ -1690,6 +1693,11 @@ class BIP32_HD_Wallet(BIP32_RD_Wallet):
|
||||||
set(['%d' % n for n in range(len(self.accounts))]))
|
set(['%d' % n for n in range(len(self.accounts))]))
|
||||||
return len(self.accounts)
|
return len(self.accounts)
|
||||||
|
|
||||||
|
def default_account_id(self):
|
||||||
|
visible_acc_ids = [acc_id for acc_id in self.accounts.keys()
|
||||||
|
if self.show_account(acc_id)]
|
||||||
|
return visible_acc_ids[0]
|
||||||
|
|
||||||
def show_account(self, account_id):
|
def show_account(self, account_id):
|
||||||
return self.account_is_used(account_id) or account_id in self.labels
|
return self.account_is_used(account_id) or account_id in self.labels
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue