electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 05342c553727707a25641b64dcb78f748cfd3e70
parent 8f31d224aa30bf9fc1a080e5e52e08b9c984caab
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 23 Mar 2018 19:42:04 +0100

Merge pull request #4117 from SomberNight/pay_to_script

fix paying to script
Diffstat:
Mgui/qt/paytoedit.py | 8++++++--
Mlib/transaction.py | 12++++--------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py @@ -31,6 +31,7 @@ from .qrtextedit import ScanQRTextEdit import re from decimal import Decimal from electrum import bitcoin +from electrum.util import bfh from . import util @@ -93,9 +94,12 @@ class PayToEdit(ScanQRTextEdit): for word in x.split(): if word[0:3] == 'OP_': assert word in opcodes.lookup - script += chr(opcodes.lookup[word]) + opcode_int = opcodes.lookup[word] + assert opcode_int < 256 # opcode is single-byte + script += bitcoin.int_to_hex(opcode_int) else: - script += push_script(word).decode('hex') + bfh(word) # to test it is hex data + script += push_script(word) return script def parse_amount(self, x): diff --git a/lib/transaction.py b/lib/transaction.py @@ -229,10 +229,10 @@ opcodes = Enumeration("Opcodes", [ "OP_WITHIN", "OP_RIPEMD160", "OP_SHA1", "OP_SHA256", "OP_HASH160", "OP_HASH256", "OP_CODESEPARATOR", "OP_CHECKSIG", "OP_CHECKSIGVERIFY", "OP_CHECKMULTISIG", "OP_CHECKMULTISIGVERIFY", - ("OP_SINGLEBYTE_END", 0xF0), - ("OP_DOUBLEBYTE_BEGIN", 0xF000), - "OP_PUBKEY", "OP_PUBKEYHASH", - ("OP_INVALIDOPCODE", 0xFFFF), + ("OP_NOP1", 0xB0), + ("OP_CHECKLOCKTIMEVERIFY", 0xB1), ("OP_CHECKSEQUENCEVERIFY", 0xB2), + "OP_NOP4", "OP_NOP5", "OP_NOP6", "OP_NOP7", "OP_NOP8", "OP_NOP9", "OP_NOP10", + ("OP_INVALIDOPCODE", 0xFF), ]) @@ -242,10 +242,6 @@ def script_GetOp(_bytes): vch = None opcode = _bytes[i] i += 1 - if opcode >= opcodes.OP_SINGLEBYTE_END: - opcode <<= 8 - opcode |= _bytes[i] - i += 1 if opcode <= opcodes.OP_PUSHDATA4: nSize = opcode