electrum

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

commit 41802d8094f07398254ed49093ce312a56f29cce
parent 41f160dd74dc60434acac882393374cb15a381f0
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon, 27 May 2019 20:24:09 +0200

qt receive tab: "receive address" is now coloured red if already used

closes #3812
closes #5374

Diffstat:
Melectrum/gui/qt/main_window.py | 11+++++++++++
Melectrum/gui/qt/request_list.py | 3++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -907,6 +907,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): msg = _('Bitcoin address where the payment should be received. Note that each payment request uses a different Bitcoin address.') self.receive_address_label = HelpLabel(_('Receiving address'), msg) self.receive_address_e.textChanged.connect(self.update_receive_qr) + self.receive_address_e.textChanged.connect(self.update_receive_address_styling) self.receive_address_e.setFocusPolicy(Qt.ClickFocus) grid.addWidget(self.receive_address_label, 0, 0) grid.addWidget(self.receive_address_e, 0, 1, 1, -1) @@ -1152,6 +1153,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): if self.qr_window and self.qr_window.isVisible(): self.qr_window.qrw.setData(uri) + def update_receive_address_styling(self): + addr = str(self.receive_address_e.text()) + if self.wallet.is_used(addr): + self.receive_address_e.setStyleSheet(ColorScheme.RED.as_stylesheet(True)) + self.receive_address_e.setToolTip(_("This address has already been used. " + "For better privacy, do not reuse it for new payments.")) + else: + self.receive_address_e.setStyleSheet("") + self.receive_address_e.setToolTip("") + def set_feerounding_text(self, num_satoshis_added): self.feerounding_text = (_('Additional {} satoshis are going to be added.') .format(num_satoshis_added)) diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py @@ -105,9 +105,10 @@ class RequestList(MyTreeView): except InternalAddressCorruption as e: self.parent.show_error(str(e)) addr = '' - if not current_address in domain and addr: + if current_address not in domain and addr: self.parent.set_receive_address(addr) self.parent.new_request_button.setEnabled(addr != current_address) + self.parent.update_receive_address_styling() self.model().clear() self.update_headers(self.__class__.headers)