当前位置: 首页>>代码示例>>Python>>正文


Python script_interpreter.ScriptInterpreter类代码示例

本文整理汇总了Python中two1.bitcoin.script_interpreter.ScriptInterpreter的典型用法代码示例。如果您正苦于以下问题:Python ScriptInterpreter类的具体用法?Python ScriptInterpreter怎么用?Python ScriptInterpreter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ScriptInterpreter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_disabled_ops

def test_disabled_ops():
    for opcode in ScriptInterpreter.DISABLED_OPS:
        si = ScriptInterpreter()
        si.run_script(Script("OP_1 " + opcode + " OP_2"))

        assert not si.valid
        assert list(si.stack) == [1]
开发者ID:0xDeX,项目名称:two1-python,代码行数:7,代码来源:test_script_interpreter.py

示例2: test_op_return

def test_op_return():
    s = Script("OP_RETURN 0x010203")

    si = ScriptInterpreter()
    si.run_script(s)

    assert si.stop
    assert len(si.stack) == 0
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例3: test_op_2swap

def test_op_2swap():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 OP_6 OP_2SWAP")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 6
    assert list(si.stack) == [1, 2, 5, 6, 3, 4]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例4: test_op_2rot

def test_op_2rot():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 OP_6 OP_2ROT")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 6
    assert list(si.stack) == [3, 4, 5, 6, 1, 2]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例5: test_op_sha256

def test_op_sha256():
    s = Script("0x01 OP_SHA256")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 1
    assert si.stack[0] == b'K\xf5\x12/4ET\xc5;\xde.\xbb\x8c\xd2\xb7\xe3\xd1`\n\xd61\xc3\x85\xa5\xd7\xcc\xe2<w\x85E\x9a'
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例6: test_op_0

def test_op_0():
    s = Script("OP_0")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 1
    assert si.stack[0] == b''
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例7: test_op_size

def test_op_size():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 0x010203 OP_SIZE")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 7
    assert list(si.stack) == [1, 2, 3, 4, 5, b'\x01\x02\x03', 3]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例8: test_op_abs

def test_op_abs():
    s = Script("OP_3 OP_NEGATE OP_ABS")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 1
    assert list(si.stack) == [3]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例9: test_op_add

def test_op_add():
    s = Script("OP_1 OP_2 OP_ADD")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 1
    assert list(si.stack) == [3]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例10: test_op_nip

def test_op_nip():
    s = Script("OP_1 OP_2 OP_3 OP_NIP")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 2
    assert list(si.stack) == [1, 3]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例11: test_op_1sub

def test_op_1sub():
    s = Script("OP_3 OP_1SUB")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 1
    assert list(si.stack) == [2]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例12: test_op_hash160

def test_op_hash160():
    s = Script("0x01 OP_HASH160")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 1
    assert si.stack[0] == b'\xc5\x1bf\xbc\xed^D\x91\x00\x1b\xd7\x02f\x97p\xdc\xcfD\t\x82'
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例13: test_op_sha1

def test_op_sha1():
    s = Script("0x01 OP_SHA1")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 1
    assert si.stack[0] == b'\xbf\x8bE0\xd8\xd2F\xddt\xacS\xa14q\xbb\xa1yA\xdf\xf7'
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例14: test_op_3dup

def test_op_3dup():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 OP_3DUP")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 8
    assert list(si.stack) == [1, 2, 3, 4, 5, 3, 4, 5]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py

示例15: test_op_2over

def test_op_2over():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 OP_2OVER")

    si = ScriptInterpreter()
    si.run_script(s)

    assert len(si.stack) == 7
    assert list(si.stack) == [1, 2, 3, 4, 5, 2, 3]
开发者ID:0xDeX,项目名称:two1-python,代码行数:8,代码来源:test_script_interpreter.py


注:本文中的two1.bitcoin.script_interpreter.ScriptInterpreter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。