tdisplay and encode only hex with OP_RETURN - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 9a6d98f899c112ceb88e5543163fcf552e82df09 DIR parent 9285074f00e0adef2420453671bb3fb88a90986e HTML Author: ThomasV <thomasv@gitorious> Date: Thu, 15 Jan 2015 17:55:10 +0100 display and encode only hex with OP_RETURN Diffstat: M gui/qt/paytoedit.py | 10 +++++----- M lib/transaction.py | 5 +---- 2 files changed, 6 insertions(+), 9 deletions(-) --- DIR diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py t@@ -66,17 +66,17 @@ class PayToEdit(ScanQRTextEdit): self.setStyleSheet("QWidget { background-color:#ffcccc;}") 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: - type = 'op_return' - address = m.group(1) + _type = 'op_return' + address = m.group(1).decode('hex') amount = 0 else: x, y = line.split(',') - type = 'address' + _type = 'address' address = self.parse_address(x) amount = self.parse_amount(y) - return type, address, amount + return _type, address, amount def parse_amount(self, x): DIR diff --git a/lib/transaction.py b/lib/transaction.py t@@ -757,10 +757,7 @@ class Transaction: elif type == 'pubkey': addr = public_key_to_bc_address(x.decode('hex')) elif type == 'op_return': - try: - addr = 'OP_RETURN: "' + x.decode('utf8') + '"' - except: - addr = 'OP_RETURN: "' + x.encode('hex') + '"' + addr = 'OP_RETURN ' + x.encode('hex') else: addr = "(None)" o.append((addr,v)) # consider using yield (addr, v)