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

Method is_push_only

bitcoin/core/script.py:712–728  ·  view source on GitHub ↗

Test if the script only contains pushdata ops Note that this test is consensus-critical. Scripts that contain invalid pushdata ops return False, matching the behavior in Bitcoin Core.

(self)

Source from the content-addressed store, hash-verified

710 return len(self) == 35 and self[0:3] == b'\x22\x00\x20'
711
712 def is_push_only(self):
713 """Test if the script only contains pushdata ops
714
715 Note that this test is consensus-critical.
716
717 Scripts that contain invalid pushdata ops return False, matching the
718 behavior in Bitcoin Core.
719 """
720 try:
721 for (op, op_data, idx) in self.raw_iter():
722 # Note how OP_RESERVED is considered a pushdata op.
723 if op > OP_16:
724 return False
725
726 except CScriptInvalidError:
727 return False
728 return True
729
730 def has_canonical_pushes(self):
731 """Test if script only uses canonical pushes

Callers 2

TMethod · 0.95
VerifyScriptFunction · 0.80

Calls 1

raw_iterMethod · 0.95

Tested by 1

TMethod · 0.76