Decred CSV test.

This commit is contained in:
tecnovert
2024-04-29 00:40:14 +02:00
parent ab472c04be
commit 74c7072926
6 changed files with 130 additions and 8 deletions

View File

@@ -9,9 +9,15 @@ OP_0 = 0x00
OP_DATA_1 = 0x01
OP_1NEGATE = 0x4f
OP_1 = 0x51
OP_EQUAL = 0x87
OP_PUSHDATA1 = 0x4c
OP_PUSHDATA2 = 0x4d
OP_PUSHDATA4 = 0x4e
OP_DUP = 0x76
OP_EQUALVERIFY = 0x88
OP_HASH160 = 0xa9
OP_CHECKSIG = 0xac
OP_CHECKSEQUENCEVERIFY = 0xb2
def push_script_data(data_array: bytearray, data: bytes) -> None:
@@ -28,7 +34,7 @@ def push_script_data(data_array: bytearray, data: bytes) -> None:
return
if len_data < OP_PUSHDATA1:
data_array += bytes(((OP_DATA_1 - 1) + len_data,))
data_array += len_data.to_bytes(1)
elif len_data <= 0xff:
data_array += bytes((OP_PUSHDATA1, len_data))
elif len_data <= 0xffff:
@@ -36,4 +42,5 @@ def push_script_data(data_array: bytearray, data: bytes) -> None:
else:
data_array += bytes((OP_PUSHDATA4,)) + len_data.to_bytes(4, 'little')
print('[rm] data_array', (data_array + data).hex())
data_array += data