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

Method to_p2sh_scriptPubKey

bitcoin/core/script.py:777–791  ·  view source on GitHub ↗

Create P2SH scriptPubKey from this redeemScript That is, create the P2SH scriptPubKey that requires this script as a redeemScript to spend. checksize - Check if the redeemScript is larger than the 520-byte max pushdata limit; raise ValueError if limit exceeded.

(self, checksize=True)

Source from the content-addressed store, hash-verified

775 return True
776
777 def to_p2sh_scriptPubKey(self, checksize=True):
778 """Create P2SH scriptPubKey from this redeemScript
779
780 That is, create the P2SH scriptPubKey that requires this script as a
781 redeemScript to spend.
782
783 checksize - Check if the redeemScript is larger than the 520-byte max
784 pushdata limit; raise ValueError if limit exceeded.
785
786 Since a >520-byte PUSHDATA makes EvalScript() fail, it's not actually
787 possible to redeem P2SH outputs with redeem scripts >520 bytes.
788 """
789 if checksize and len(self) > MAX_SCRIPT_ELEMENT_SIZE:
790 raise ValueError("redeemScript exceeds max allowed size; P2SH output would be unspendable")
791 return CScript([OP_HASH160, bitcoin.core.Hash160(self), OP_EQUAL])
792
793 def GetSigOpCount(self, fAccurate):
794 """Get the SigOp count.

Callers 5

TMethod · 0.95
from_redeemScriptMethod · 0.80
publish-text.pyFile · 0.80

Calls 1

CScriptClass · 0.85

Tested by 2

TMethod · 0.76