MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / encode_op_n

Method encode_op_n

bitcoin/core/script.py:54–62  ·  view source on GitHub ↗

Encode a small integer op, returning an opcode

(n)

Source from the content-addressed store, hash-verified

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

Callers 2

__coerce_instanceMethod · 0.80
tMethod · 0.80

Calls 1

CScriptOpClass · 0.85

Tested by 1

tMethod · 0.64