• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python script_interpreter.ScriptInterpreter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_op_2drop

def test_op_2drop():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 OP_2DROP")

    si = ScriptInterpreter()
    si.run_script(s)

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


示例17: test_op_tuck

def test_op_tuck():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 OP_TUCK")

    si = ScriptInterpreter()
    si.run_script(s)

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


示例18: test_op_rot

def test_op_rot():
    s = Script("OP_1 OP_2 OP_3 OP_4 OP_5 OP_ROT")

    si = ScriptInterpreter()
    si.run_script(s)

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


示例19: test_op_1negate

def test_op_1negate():
    s = Script("OP_1NEGATE")

    si = ScriptInterpreter()
    si.run_script(s)

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


示例20: test_op_drop

def test_op_drop():
    s = Script("OP_1 OP_IFDUP OP_DROP")

    si = ScriptInterpreter()
    si.run_script(s)

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.PhoneDevice类代码示例发布时间:2022-05-27
下一篇:
Python app.test_client函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap