mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
display and encode only hex with OP_RETURN
This commit is contained in:
parent
9285074f00
commit
9a6d98f899
2 changed files with 6 additions and 9 deletions
|
@ -66,17 +66,17 @@ class PayToEdit(ScanQRTextEdit):
|
||||||
self.setStyleSheet("QWidget { background-color:#ffcccc;}")
|
self.setStyleSheet("QWidget { background-color:#ffcccc;}")
|
||||||
|
|
||||||
def parse_address_and_amount(self, line):
|
def parse_address_and_amount(self, line):
|
||||||
m = re.match('^OP_RETURN\s+"(.+)"$', line.strip())
|
m = re.match('^OP_RETURN\s+([0-9a-fA-F]+)$', line.strip())
|
||||||
if m:
|
if m:
|
||||||
type = 'op_return'
|
_type = 'op_return'
|
||||||
address = m.group(1)
|
address = m.group(1).decode('hex')
|
||||||
amount = 0
|
amount = 0
|
||||||
else:
|
else:
|
||||||
x, y = line.split(',')
|
x, y = line.split(',')
|
||||||
type = 'address'
|
_type = 'address'
|
||||||
address = self.parse_address(x)
|
address = self.parse_address(x)
|
||||||
amount = self.parse_amount(y)
|
amount = self.parse_amount(y)
|
||||||
return type, address, amount
|
return _type, address, amount
|
||||||
|
|
||||||
|
|
||||||
def parse_amount(self, x):
|
def parse_amount(self, x):
|
||||||
|
|
|
@ -757,10 +757,7 @@ class Transaction:
|
||||||
elif type == 'pubkey':
|
elif type == 'pubkey':
|
||||||
addr = public_key_to_bc_address(x.decode('hex'))
|
addr = public_key_to_bc_address(x.decode('hex'))
|
||||||
elif type == 'op_return':
|
elif type == 'op_return':
|
||||||
try:
|
addr = 'OP_RETURN ' + x.encode('hex')
|
||||||
addr = 'OP_RETURN: "' + x.decode('utf8') + '"'
|
|
||||||
except:
|
|
||||||
addr = 'OP_RETURN: "' + x.encode('hex') + '"'
|
|
||||||
else:
|
else:
|
||||||
addr = "(None)"
|
addr = "(None)"
|
||||||
o.append((addr,v)) # consider using yield (addr, v)
|
o.append((addr,v)) # consider using yield (addr, v)
|
||||||
|
|
Loading…
Add table
Reference in a new issue