electrum

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

commit d403c59ad715f614a63da24f0073571102707833
parent b88fa2046c9263cfee4d94d695addda356c1a42e
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat,  9 Dec 2017 21:23:10 +0100

fix #3486

Diffstat:
Mgui/qt/main_window.py | 5+++++
Mgui/qt/util.py | 16++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -2348,6 +2348,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): vbox.addWidget(keys_e) addresses = self.wallet.get_unused_addresses() + if not addresses: + try: + addresses = self.wallet.get_receiving_addresses() + except AttributeError: + addresses = self.wallet.get_addresses() h, address_e = address_field(addresses) vbox.addLayout(h) diff --git a/gui/qt/util.py b/gui/qt/util.py @@ -302,12 +302,20 @@ class ChoicesLayout(object): def address_field(addresses): hbox = QHBoxLayout() address_e = QLineEdit() - if addresses: + if addresses and len(addresses) > 0: address_e.setText(addresses[0]) + else: + addresses = [] def func(): - i = addresses.index(str(address_e.text())) + 1 - i = i % len(addresses) - address_e.setText(addresses[i]) + try: + i = addresses.index(str(address_e.text())) + 1 + i = i % len(addresses) + address_e.setText(addresses[i]) + except ValueError: + # the user might have changed address_e to an + # address not in the wallet (or to something that isn't an address) + if addresses and len(addresses) > 0: + address_e.setText(addresses[0]) button = QPushButton(_('Address')) button.clicked.connect(func) hbox.addWidget(button)