MCPcopy
hub / github.com/petertodd/python-bitcoinlib / _CheckSig

Function _CheckSig

bitcoin/core/scripteval.py:128–146  ·  view source on GitHub ↗
(sig, pubkey, script, txTo, inIdx, err_raiser)

Source from the content-addressed store, hash-verified

126
127
128def _CheckSig(sig, pubkey, script, txTo, inIdx, err_raiser):
129 key = bitcoin.core.key.CECKey()
130 key.set_pubkey(pubkey)
131
132 if len(sig) == 0:
133 return False
134 hashtype = sig[-1]
135 sig = sig[:-1]
136
137 # Raw signature hash due to the SIGHASH_SINGLE bug
138 #
139 # Note that we never raise an exception if RawSignatureHash() returns an
140 # error code. However the first error code case, where inIdx >=
141 # len(txTo.vin), shouldn't ever happen during EvalScript() as that would
142 # imply the scriptSig being checked doesn't correspond to a valid txout -
143 # that should cause other validation machinery to fail long before we ever
144 # got here.
145 (h, err) = RawSignatureHash(script, txTo, inIdx, hashtype)
146 return key.verify(h, sig)
147
148
149def _CheckMultiSig(opcode, script, stack, txTo, inIdx, flags, err_raiser, nOpCount):

Callers 2

_CheckMultiSigFunction · 0.85
_EvalScriptFunction · 0.85

Calls 3

set_pubkeyMethod · 0.95
verifyMethod · 0.95
RawSignatureHashFunction · 0.85

Tested by

no test coverage detected