mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 02:05:19 +00:00
Merge pull request #4117 from SomberNight/pay_to_script
fix paying to script
This commit is contained in:
commit
05342c5537
2 changed files with 10 additions and 10 deletions
|
@ -31,6 +31,7 @@ from .qrtextedit import ScanQRTextEdit
|
||||||
import re
|
import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from electrum import bitcoin
|
from electrum import bitcoin
|
||||||
|
from electrum.util import bfh
|
||||||
|
|
||||||
from . import util
|
from . import util
|
||||||
|
|
||||||
|
@ -93,9 +94,12 @@ class PayToEdit(ScanQRTextEdit):
|
||||||
for word in x.split():
|
for word in x.split():
|
||||||
if word[0:3] == 'OP_':
|
if word[0:3] == 'OP_':
|
||||||
assert word in opcodes.lookup
|
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:
|
else:
|
||||||
script += push_script(word).decode('hex')
|
bfh(word) # to test it is hex data
|
||||||
|
script += push_script(word)
|
||||||
return script
|
return script
|
||||||
|
|
||||||
def parse_amount(self, x):
|
def parse_amount(self, x):
|
||||||
|
|
|
@ -229,10 +229,10 @@ opcodes = Enumeration("Opcodes", [
|
||||||
"OP_WITHIN", "OP_RIPEMD160", "OP_SHA1", "OP_SHA256", "OP_HASH160",
|
"OP_WITHIN", "OP_RIPEMD160", "OP_SHA1", "OP_SHA256", "OP_HASH160",
|
||||||
"OP_HASH256", "OP_CODESEPARATOR", "OP_CHECKSIG", "OP_CHECKSIGVERIFY", "OP_CHECKMULTISIG",
|
"OP_HASH256", "OP_CODESEPARATOR", "OP_CHECKSIG", "OP_CHECKSIGVERIFY", "OP_CHECKMULTISIG",
|
||||||
"OP_CHECKMULTISIGVERIFY",
|
"OP_CHECKMULTISIGVERIFY",
|
||||||
("OP_SINGLEBYTE_END", 0xF0),
|
("OP_NOP1", 0xB0),
|
||||||
("OP_DOUBLEBYTE_BEGIN", 0xF000),
|
("OP_CHECKLOCKTIMEVERIFY", 0xB1), ("OP_CHECKSEQUENCEVERIFY", 0xB2),
|
||||||
"OP_PUBKEY", "OP_PUBKEYHASH",
|
"OP_NOP4", "OP_NOP5", "OP_NOP6", "OP_NOP7", "OP_NOP8", "OP_NOP9", "OP_NOP10",
|
||||||
("OP_INVALIDOPCODE", 0xFFFF),
|
("OP_INVALIDOPCODE", 0xFF),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,10 +242,6 @@ def script_GetOp(_bytes):
|
||||||
vch = None
|
vch = None
|
||||||
opcode = _bytes[i]
|
opcode = _bytes[i]
|
||||||
i += 1
|
i += 1
|
||||||
if opcode >= opcodes.OP_SINGLEBYTE_END:
|
|
||||||
opcode <<= 8
|
|
||||||
opcode |= _bytes[i]
|
|
||||||
i += 1
|
|
||||||
|
|
||||||
if opcode <= opcodes.OP_PUSHDATA4:
|
if opcode <= opcodes.OP_PUSHDATA4:
|
||||||
nSize = opcode
|
nSize = opcode
|
||||||
|
|
Loading…
Add table
Reference in a new issue