1
0

qt: fix paying to openalias

Probably got broken in https://github.com/spesmilo/electrum/pull/7839 ,
which got released in 4.3.0, ~7 months ago.
As no one complained, this really again raises the question of removing openalias...

related https://github.com/spesmilo/electrum/issues/6232
This commit is contained in:
SomberNight
2023-03-14 17:21:33 +00:00
parent 02a2f02d02
commit d166fa886e

View File

@@ -268,6 +268,7 @@ class PayToEdit(Logger, GenericInputHandler):
if full_check: if full_check:
self.previous_payto = str(text).strip() self.previous_payto = str(text).strip()
self.errors = [] self.errors = []
errors = []
if self.disable_checks: if self.disable_checks:
return return
# filter out empty lines # filter out empty lines
@@ -301,7 +302,7 @@ class PayToEdit(Logger, GenericInputHandler):
try: try:
self.payto_scriptpubkey = self.parse_output(data) self.payto_scriptpubkey = self.parse_output(data)
except Exception as e: except Exception as e:
self.errors.append(PayToLineError(line_content=data, exc=e)) errors.append(PayToLineError(line_content=data, exc=e))
else: else:
self.send_tab.set_onchain(True) self.send_tab.set_onchain(True)
self.send_tab.lock_amount(False) self.send_tab.lock_amount(False)
@@ -312,6 +313,9 @@ class PayToEdit(Logger, GenericInputHandler):
if oa_data: if oa_data:
self._set_openalias(key=data, data=oa_data) self._set_openalias(key=data, data=oa_data)
return return
# all parsing attempts failed, so now expose the errors:
if errors:
self.errors = errors
else: else:
# there are multiple lines # there are multiple lines
self._parse_as_multiline(lines, raise_errors=False) self._parse_as_multiline(lines, raise_errors=False)
@@ -389,7 +393,7 @@ class PayToEdit(Logger, GenericInputHandler):
address = data.get('address') address = data.get('address')
name = data.get('name') name = data.get('name')
new_url = key + ' <' + address + '>' new_url = key + ' <' + address + '>'
self.setTextNoCheck(new_url) self.setText(new_url)
#if self.win.config.get('openalias_autoadd') == 'checked': #if self.win.config.get('openalias_autoadd') == 'checked':
self.win.contacts[key] = ('openalias', name) self.win.contacts[key] = ('openalias', name)