MCPcopy Index your code
hub / github.com/jimmysong/programmingbitcoin / is_p2sh_script_pubkey

Method is_p2sh_script_pubkey

code-ch13/script.py:257–264  ·  view source on GitHub ↗

Returns whether this follows the OP_HASH160 <20 byte hash> OP_EQUAL pattern.

(self)

Source from the content-addressed store, hash-verified

255 and self.cmds[3] == 0x88 and self.cmds[4] == 0xac
256
257 def is_p2sh_script_pubkey(self):
258 ''&#x27;Returns whether this follows the
259 OP_HASH160 <20 byte hash> OP_EQUAL pattern.''&#x27;
260 # there should be exactly 3 cmds
261 # OP_HASH160 (0xa9), 20-byte hash, OP_EQUAL (0x87)
262 return len(self.cmds) == 3 and self.cmds[0] == 0xa9 \
263 and type(self.cmds[1]) == bytes and len(self.cmds[1]) == 20 \
264 and self.cmds[2] == 0x87
265
266 # tag::source2[]
267 def is_p2wpkh_script_pubkey(self): # <2>

Callers 2

addressMethod · 0.95
verify_inputMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected