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

Function VerifySignature

bitcoin/core/scripteval.py:793–814  ·  view source on GitHub ↗

Verify a scriptSig signature can spend a txout Verifies that the scriptSig in txTo.vin[inIdx] is a valid scriptSig for the corresponding COutPoint in transaction txFrom.

(txFrom, txTo, inIdx)

Source from the content-addressed store, hash-verified

791 pass
792
793def VerifySignature(txFrom, txTo, inIdx):
794 """Verify a scriptSig signature can spend a txout
795
796 Verifies that the scriptSig in txTo.vin[inIdx] is a valid scriptSig for the
797 corresponding COutPoint in transaction txFrom.
798 """
799 if inIdx < 0:
800 raise VerifySignatureError("inIdx negative")
801 if inIdx >= len(txTo.vin):
802 raise VerifySignatureError("inIdx >= len(txTo.vin)")
803 txin = txTo.vin[inIdx]
804
805 if txin.prevout.n < 0:
806 raise VerifySignatureError("txin prevout.n negative")
807 if txin.prevout.n >= len(txFrom.vout):
808 raise VerifySignatureError("txin prevout.n >= len(txFrom.vout)")
809 txout = txFrom.vout[txin.prevout.n]
810
811 if txin.prevout.hash != txFrom.GetTxid():
812 raise VerifySignatureError("prevout hash does not match txFrom")
813
814 VerifyScript(txin.scriptSig, txout.scriptPubKey, txTo, inIdx)
815
816
817__all__ = (

Callers

nothing calls this directly

Calls 3

VerifyScriptFunction · 0.85
GetTxidMethod · 0.80

Tested by

no test coverage detected