wallet: add get_label_for_address, and make get_label private
fixes https://github.com/spesmilo/electrum/issues/7919 In the past, when creating payment requests, we keyed them by on-chain address, and set/saved the msg of the request as label for the address. Many places in the code were calling wallet.get_label(addr) with the expectation that relevant payment requests are found and their message/description (if any) is considered. wallet.get_label(key) is now made private, and instead the explicit non-polymorphic wallet.get_label_for_{address,rhash,txid} alternatives should be used.
This commit is contained in:
@@ -304,7 +304,7 @@ class ElectrumWindow(App, Logger, EventListener):
|
||||
def on_event_payment_succeeded(self, wallet, key):
|
||||
if wallet != self.wallet:
|
||||
return
|
||||
description = self.wallet.get_label(key)
|
||||
description = self.wallet.get_label_for_rhash(key)
|
||||
self.show_info(_('Payment succeeded') + '\n\n' + description)
|
||||
self._trigger_update_history()
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ class AddressesDialog(Factory.Popup):
|
||||
n = 0
|
||||
cards = []
|
||||
for address in _list:
|
||||
label = wallet.get_label(address)
|
||||
label = wallet.get_label_for_address(address)
|
||||
balance = sum(wallet.get_addr_balance(address))
|
||||
is_used_and_empty = wallet.adb.is_used(address) and balance == 0
|
||||
if self.show_used == 1 and (balance or is_used_and_empty):
|
||||
|
||||
Reference in New Issue
Block a user