Browse Source

qt: fix enable/disable max button for openalias and restrict openalias to address only

master
Sander van Grieken 3 years ago
parent
commit
3a1e5244b8
  1. 8
      electrum/gui/qt/send_tab.py
  2. 3
      electrum/payment_identifier.py

8
electrum/gui/qt/send_tab.py

@ -207,7 +207,8 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
def spend_max(self):
assert self.payto_e.payment_identifier is not None
assert self.payto_e.payment_identifier.type in [PaymentIdentifierType.SPK, PaymentIdentifierType.MULTILINE]
assert self.payto_e.payment_identifier.type in [PaymentIdentifierType.SPK, PaymentIdentifierType.MULTILINE,
PaymentIdentifierType.OPENALIAS]
if run_hook('abort_send', self):
return
outputs = self.payto_e.payment_identifier.get_onchain_outputs('!')
@ -379,7 +380,10 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
lock_recipient = pi.type != PaymentIdentifierType.SPK \
and not (pi.type == PaymentIdentifierType.EMAILLIKE and pi.state in [PaymentIdentifierState.NOT_FOUND,PaymentIdentifierState.NEED_RESOLVE])
lock_amount = pi.is_amount_locked()
lock_max = lock_amount or pi.type in [PaymentIdentifierType.BOLT11, PaymentIdentifierType.LNURLP, PaymentIdentifierType.LNADDR]
lock_max = lock_amount \
or pi.type in [PaymentIdentifierType.BOLT11, PaymentIdentifierType.LNURLP,
PaymentIdentifierType.LNADDR, PaymentIdentifierType.EMAILLIKE]
self.lock_fields(lock_recipient=lock_recipient,
lock_amount=lock_amount,
lock_max=lock_max,

3
electrum/payment_identifier.py

@ -401,7 +401,8 @@ class PaymentIdentifier(Logger):
'WARNING: the alias "{}" could not be validated via an additional '
'security check, DNSSEC, and thus may not be correct.').format(self.emaillike)
try:
scriptpubkey = self.parse_output(address)
assert bitcoin.is_address(address)
scriptpubkey = bytes.fromhex(bitcoin.address_to_script(address))
self._type = PaymentIdentifierType.OPENALIAS
self.spk = scriptpubkey
self.set_state(PaymentIdentifierState.AVAILABLE)

Loading…
Cancel
Save