mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 07:51:27 +00:00
openalias: minor clean-up
This commit is contained in:
parent
af232223ee
commit
f819e9b6f4
2 changed files with 6 additions and 4 deletions
|
@ -98,7 +98,7 @@ class Contacts(dict):
|
||||||
try:
|
try:
|
||||||
records, validated = dnssec.query(url, dns.rdatatype.TXT)
|
records, validated = dnssec.query(url, dns.rdatatype.TXT)
|
||||||
except DNSException as e:
|
except DNSException as e:
|
||||||
print_error('Error resolving openalias: ', str(e))
|
print_error(f'Error resolving openalias: {repr(e)}')
|
||||||
return None
|
return None
|
||||||
prefix = 'btc'
|
prefix = 'btc'
|
||||||
for record in records:
|
for record in records:
|
||||||
|
|
|
@ -29,7 +29,7 @@ from decimal import Decimal
|
||||||
from PyQt5.QtGui import *
|
from PyQt5.QtGui import *
|
||||||
|
|
||||||
from electrum import bitcoin
|
from electrum import bitcoin
|
||||||
from electrum.util import bfh
|
from electrum.util import bfh, PrintError
|
||||||
from electrum.transaction import TxOutput
|
from electrum.transaction import TxOutput
|
||||||
|
|
||||||
from .qrtextedit import ScanQRTextEdit
|
from .qrtextedit import ScanQRTextEdit
|
||||||
|
@ -42,7 +42,7 @@ frozen_style = "QWidget { background-color:none; border:none;}"
|
||||||
normal_style = "QPlainTextEdit { }"
|
normal_style = "QPlainTextEdit { }"
|
||||||
|
|
||||||
|
|
||||||
class PayToEdit(CompletionTextEdit, ScanQRTextEdit):
|
class PayToEdit(CompletionTextEdit, ScanQRTextEdit, PrintError):
|
||||||
|
|
||||||
def __init__(self, win):
|
def __init__(self, win):
|
||||||
CompletionTextEdit.__init__(self)
|
CompletionTextEdit.__init__(self)
|
||||||
|
@ -215,6 +215,7 @@ class PayToEdit(CompletionTextEdit, ScanQRTextEdit):
|
||||||
if self.is_pr:
|
if self.is_pr:
|
||||||
return
|
return
|
||||||
key = str(self.toPlainText())
|
key = str(self.toPlainText())
|
||||||
|
key = key.strip() # strip whitespaces
|
||||||
if key == self.previous_payto:
|
if key == self.previous_payto:
|
||||||
return
|
return
|
||||||
self.previous_payto = key
|
self.previous_payto = key
|
||||||
|
@ -225,7 +226,8 @@ class PayToEdit(CompletionTextEdit, ScanQRTextEdit):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
data = self.win.contacts.resolve(key)
|
data = self.win.contacts.resolve(key)
|
||||||
except:
|
except Exception as e:
|
||||||
|
self.print_error(f'error resolving address/alias: {repr(e)}')
|
||||||
return
|
return
|
||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue