Refactor OpCodes.

This commit is contained in:
tecnovert 2019-11-18 22:53:33 +02:00
parent e390509946
commit b1f5be083c
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
2 changed files with 28 additions and 19 deletions

View File

@ -37,6 +37,9 @@ from .chainparams import (
chainparams,
Coins,
)
from .script import (
OpCodes,
)
from .messages_pb2 import (
OfferMessage,
BidMessage,
@ -107,25 +110,6 @@ class TxStates(IntEnum):
TX_REFUNDED = auto()
class OpCodes(IntEnum):
OP_0 = 0x00,
OP_PUSHDATA1 = 0x4c,
OP_1 = 0x51,
OP_IF = 0x63,
OP_ELSE = 0x67,
OP_ENDIF = 0x68,
OP_DROP = 0x75,
OP_DUP = 0x76,
OP_SIZE = 0x82,
OP_EQUAL = 0x87,
OP_EQUALVERIFY = 0x88,
OP_SHA256 = 0xa8,
OP_HASH160 = 0xa9,
OP_CHECKSIG = 0xac,
OP_CHECKLOCKTIMEVERIFY = 0xb1,
OP_CHECKSEQUENCEVERIFY = 0xb2,
class TxTypes(IntEnum):
ITX = auto()
PTX = auto()

25
basicswap/script.py Normal file
View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE.txt or http://www.opensource.org/licenses/mit-license.php.
from enum import IntEnum, auto
class OpCodes(IntEnum):
OP_0 = 0x00,
OP_PUSHDATA1 = 0x4c,
OP_1 = 0x51,
OP_IF = 0x63,
OP_ELSE = 0x67,
OP_ENDIF = 0x68,
OP_DROP = 0x75,
OP_DUP = 0x76,
OP_SIZE = 0x82,
OP_EQUAL = 0x87,
OP_EQUALVERIFY = 0x88,
OP_SHA256 = 0xa8,
OP_HASH160 = 0xa9,
OP_CHECKSIG = 0xac,
OP_CHECKLOCKTIMEVERIFY = 0xb1,
OP_CHECKSEQUENCEVERIFY = 0xb2,