MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / encode_op_n

Method encode_op_n

qa/rpc-tests/test_framework/script.py:58–66  ·  view source on GitHub ↗

Encode a small integer op, returning an opcode

(n)

Source from the content-addressed store, hash-verified

56
57 @staticmethod
58 def encode_op_n(n):
59 """Encode a small integer op, returning an opcode"""
60 if not (0 <= n <= 16):
61 raise ValueError('Integer must be in range 0 <= n <= 16, got %d' % n)
62
63 if n == 0:
64 return OP_0
65 else:
66 return CScriptOp(OP_1 + n-1)
67
68 def decode_op_n(self):
69 """Decode a small integer opcode, returning an integer"""

Callers 1

__coerce_instanceMethod · 0.80

Calls 1

CScriptOpClass · 0.85

Tested by

no test coverage detected