mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 17:01:34 +00:00
bitcoin.py: fix op_push
8cbc5c4be4/src/script/script.h (L464)
fdc2bc867b/txscript/scriptbuilder.go (L151)
This commit is contained in:
parent
6cf334244a
commit
44bb1e9993
2 changed files with 5 additions and 5 deletions
|
@ -166,11 +166,11 @@ def var_int(i):
|
|||
|
||||
|
||||
def op_push(i):
|
||||
if i<0x4c:
|
||||
if i<0x4c: # OP_PUSHDATA1
|
||||
return int_to_hex(i)
|
||||
elif i<0xff:
|
||||
elif i<=0xff:
|
||||
return '4c' + int_to_hex(i)
|
||||
elif i<0xffff:
|
||||
elif i<=0xffff:
|
||||
return '4d' + int_to_hex(i,2)
|
||||
else:
|
||||
return '4e' + int_to_hex(i,4)
|
||||
|
|
|
@ -142,11 +142,11 @@ class Test_bitcoin(unittest.TestCase):
|
|||
self.assertEqual(op_push(0x4b), '4b')
|
||||
self.assertEqual(op_push(0x4c), '4c4c')
|
||||
self.assertEqual(op_push(0xfe), '4cfe')
|
||||
self.assertEqual(op_push(0xff), '4dff00')
|
||||
self.assertEqual(op_push(0xff), '4cff')
|
||||
self.assertEqual(op_push(0x100), '4d0001')
|
||||
self.assertEqual(op_push(0x1234), '4d3412')
|
||||
self.assertEqual(op_push(0xfffe), '4dfeff')
|
||||
self.assertEqual(op_push(0xffff), '4effff0000')
|
||||
self.assertEqual(op_push(0xffff), '4dffff')
|
||||
self.assertEqual(op_push(0x10000), '4e00000100')
|
||||
self.assertEqual(op_push(0x12345678), '4e78563412')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue