Browse Source

always display a receiving address (fix #2031)

283
ThomasV 8 years ago
parent
commit
a8c23f9bf0
  1. 9
      gui/kivy/uix/screens.py
  2. 4
      gui/qt/main_window.py
  3. 2
      gui/text.py
  4. 12
      lib/wallet.py

9
gui/kivy/uix/screens.py

@ -330,12 +330,15 @@ class ReceiveScreen(CScreen):
def get_new_address(self):
if not self.app.wallet:
return False
self.clear()
addr = self.app.wallet.get_unused_address()
if addr is None:
return False
self.clear()
addr = self.app.wallet.get_receiving_address()
b = False
else:
b = True
self.screen.address = addr
return True
return b
def on_address(self, addr):
req = self.app.wallet.get_payment_request(addr, self.app.electrum_config)

4
gui/qt/main_window.py

@ -877,8 +877,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.receive_amount_e.setAmount(None)
def clear_receive_tab(self):
addr = self.wallet.get_unused_address()
self.receive_address_e.setText(addr if addr else '')
addr = self.wallet.get_receiving_address()
self.receive_address_e.setText(addr)
self.receive_message_e.setText('')
self.receive_amount_e.setAmount(None)
self.expires_label.hide()

2
gui/text.py

@ -146,7 +146,7 @@ class ElectrumGui:
self.stdscr.addstr(self.maxy -1, self.maxx-30, ' '.join([_("Settings"), _("Network"), _("Quit")]))
def print_receive(self):
addr = self.wallet.get_unused_address()
addr = self.wallet.get_receiving_address()
self.stdscr.addstr(2, 1, "Address: "+addr)
self.print_qr(addr)

12
lib/wallet.py

@ -1119,6 +1119,18 @@ class Abstract_Wallet(PrintError):
if addrs:
return addrs[0]
def get_receiving_address(self):
# always return an address
domain = self.get_receiving_addresses()
choice = domain[0]
for addr in domain:
if addr not in self.history.keys():
if addr not in self.receive_requests.keys():
return addr
else:
choice = addr
return choice
def get_payment_status(self, address, amount):
local_height = self.get_local_height()
received, sent = self.get_addr_io(address)

Loading…
Cancel
Save