Browse Source

Added arbitrary outputs

write your own output scripts should you be so inclined.
283
dabura667 10 years ago
parent
commit
b741dd89ca
  1. 6
      gui/qt/paytoedit.py
  2. 9
      lib/transaction.py

6
gui/qt/paytoedit.py

@ -73,6 +73,12 @@ class PayToEdit(ScanQRTextEdit):
amount = 0
else:
x, y = line.split(',')
n = re.match('^CUSTOM_OUT\s+([0-9a-fA-F]+)$', x.strip())
if n:
_type = 'custom'
address = n.group(1).decode('hex')
amount = self.parse_amount(y)
else:
_type = 'address'
address = self.parse_address(x)
amount = self.parse_amount(y)

9
lib/transaction.py

@ -424,7 +424,7 @@ def get_address_from_output_script(bytes):
if match_decoded(decoded, match):
return 'op_return', decoded[1][1]
return "(None)", "(None)"
return 'custom', bytes
@ -567,8 +567,7 @@ class Transaction:
if output_type == 'op_return':
h = addr.encode('hex')
return '6a' + push_script(h)
else:
assert output_type == 'address'
elif output_type == 'address':
addrtype, hash_160 = bc_address_to_hash_160(addr)
if addrtype == 0:
script = '76a9' # op_dup, op_hash_160
@ -580,6 +579,8 @@ class Transaction:
script += '87' # op_equal
else:
raise
else:
script = addr.encode('hex')
return script
def input_script(self, txin, i, for_sig):
@ -759,7 +760,7 @@ class Transaction:
elif type == 'op_return':
addr = 'OP_RETURN ' + x.encode('hex')
else:
addr = "(None)"
addr = 'CUSTOM ' + x.encode('hex')
o.append((addr,v)) # consider using yield (addr, v)
return o

Loading…
Cancel
Save