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

Method encode_op_n

test/functional/test_framework/script.py:72–80  ·  view source on GitHub ↗

Encode a small integer op, returning an opcode

(n)

Source from the content-addressed store, hash-verified

70
71 @staticmethod
72 def encode_op_n(n):
73 """Encode a small integer op, returning an opcode"""
74 if not (0 <= n <= 16):
75 raise ValueError('Integer must be in range 0 <= n <= 16, got %d' % n)
76
77 if n == 0:
78 return OP_0
79 else:
80 return CScriptOp(OP_1 + n - 1)
81
82 def decode_op_n(self):
83 """Decode a small integer opcode, returning an integer"""

Callers 5

run_testMethod · 0.80
mutateFunction · 0.80
__coerce_instanceMethod · 0.80

Calls 1

CScriptOpClass · 0.85

Tested by 1