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)
| 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 |