diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index d1a7751a5..87e3dc266 100644 --- 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 index 602f2091f..2c0699be6 100644 --- 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)