diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 00aa44260..fa868b8a6 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -2482,7 +2482,8 @@ class ElectrumWindow(QMainWindow, PrintError): keys_e.setTabChangesFocus(True) vbox.addWidget(keys_e) - h, address_e = address_field(self.wallet.addresses(False)) + addresses = self.wallet.get_unused_addresses(self.current_account) + h, address_e = address_field(addresses) vbox.addLayout(h) vbox.addStretch(1) diff --git a/lib/wallet.py b/lib/wallet.py index b36090a34..882ba30dc 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -1258,12 +1258,16 @@ class Abstract_Wallet(PrintError): def can_change_password(self): return not self.is_watching_only() - def get_unused_address(self, account): + def get_unused_addresses(self, account): # fixme: use slots from expired requests domain = self.get_account_addresses(account, include_change=False) - for addr in domain: - if not self.history.get(addr) and addr not in self.receive_requests.keys(): - return addr + return [addr for addr in domain if not self.history.get(addr) + and addr not in self.receive_requests.keys()] + + def get_unused_address(self, account): + addrs = self.get_unused_addresses(account) + if addrs: + return addrs[0] def get_payment_request(self, addr, config): import util