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)
| 791 | pass |
| 792 | |
| 793 | def 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__ = ( |
nothing calls this directly
no test coverage detected