parameters: (self,binSig, binPubKey, txOutScript, txInTx, txInIndex, lastOpCodeSep=None)
docstring: Generic method for checking Bitcoin tx signatures.  This needs to be used for both
        OP_CHECKSIG and OP_CHECKMULTISIG.  Step 1 is to pop signature and public key off
        the stack, which must be done outside this method and passed in through the argument
        list.  The remaining steps do not require access to the stack.
docstring_summary: Generic method for checking Bitcoin tx signatures.  This needs to be used for both
        OP_CHECKSIG and OP_CHECKMULTISIG.  Step 1 is to pop signature and public key off
        the stack, which must be done outside this method and passed in through the argument
        list.  The remaining steps do not require access to the stack.
docstring_tokens: Generic method for checking Bitcoin tx signatures . This needs to be used for both OP_CHECKSIG and OP_CHECKMULTISIG . Step 1 is to pop signature and public key off the stack which must be done outside this method and passed in through the argument list . The remaining steps do not require access to the stack .
function: def checkSig(self,binSig, binPubKey, txOutScript, txInTx, txInIndex, lastOpCodeSep=None):
        """
        Generic method for checking Bitcoin tx signatures.  This needs to be used for both
        OP_CHECKSIG and OP_CHECKMULTISIG.  Step 1 is to pop signature and public key off
        the stack, which must be done outside this method and passed in through the argument
        list.  The remaining steps do not require access to the stack.
        """
  
        # 2. Subscript is from latest OP_CODESEPARATOR until end... if DNE, use whole script
        subscript = txOutScript
        if lastOpCodeSep:
           subscript = subscript[lastOpCodeSep:]
  
        # 3. Signature is deleted from subscript
        #    I'm not sure why this line is necessary - maybe for non-standard scripts?
        lengthInBinary = int_to_binary(len(binSig))
        subscript = subscript.replace( lengthInBinary + binSig, "")
  
        # 4. Hashtype is popped and stored
        hashtype = binary_to_int(binSig[-1])
        justSig = binSig[:-1]
  
        if not hashtype == 1:
           LOGERROR('Non-unity hashtypes not implemented yet! (hashtype = %d)', hashtype)
           assert(False)
  
        # 5. Make a copy of the transaction -- we will be hashing a modified version
        txCopy = PyTx().unserialize( txInTx.serialize() )
  
        # 6. Remove all OP_CODESEPARATORs
        subscript.replace( int_to_binary(OP_CODESEPARATOR), '')
  
        # 7. All the TxIn scripts in the copy are blanked (set to empty string)
        for txin in txCopy.inputs:
           txin.binScript = ''
  
        # 8. Script for the current input in the copy is set to subscript
        txCopy.inputs[txInIndex].binScript = subscript
  
        # 9. Prepare the signature and public key
        senderAddr = PyBtcAddress().createFromPublicKey(binPubKey)
        binHashCode = int_to_binary(hashtype, widthBytes=4)
        toHash = txCopy.serialize() + binHashCode
  
        # Hashes are computed as part of CppBlockUtils::CryptoECDSA methods
        ##hashToVerify = hash256(toHash)
        ##hashToVerify = binary_switchEndian(hashToVerify)
  
        # 10. Apply ECDSA signature verification
        if senderAddr.verifyDERSignature(toHash, justSig):
           return True
        else:
           return False
function_tokens: def checkSig ( self , binSig , binPubKey , txOutScript , txInTx , txInIndex , lastOpCodeSep = None ) : # 2. Subscript is from latest OP_CODESEPARATOR until end... if DNE, use whole script subscript = txOutScript if lastOpCodeSep : subscript = subscript [ lastOpCodeSep : ] # 3. Signature is deleted from subscript #    I'm not sure why this line is necessary - maybe for non-standard scripts? lengthInBinary = int_to_binary ( len ( binSig ) ) subscript = subscript . replace ( lengthInBinary + binSig , "" ) # 4. Hashtype is popped and stored hashtype = binary_to_int ( binSig [ - 1 ] ) justSig = binSig [ : - 1 ] if not hashtype == 1 : LOGERROR ( 'Non-unity hashtypes not implemented yet! (hashtype = %d)' , hashtype ) assert ( False ) # 5. Make a copy of the transaction -- we will be hashing a modified version txCopy = PyTx ( ) . unserialize ( txInTx . serialize ( ) ) # 6. Remove all OP_CODESEPARATORs subscript . replace ( int_to_binary ( OP_CODESEPARATOR ) , '' ) # 7. All the TxIn scripts in the copy are blanked (set to empty string) for txin in txCopy . inputs : txin . binScript = '' # 8. Script for the current input in the copy is set to subscript txCopy . inputs [ txInIndex ] . binScript = subscript # 9. Prepare the signature and public key senderAddr = PyBtcAddress ( ) . createFromPublicKey ( binPubKey ) binHashCode = int_to_binary ( hashtype , widthBytes = 4 ) toHash = txCopy . serialize ( ) + binHashCode # Hashes are computed as part of CppBlockUtils::CryptoECDSA methods ##hashToVerify = hash256(toHash) ##hashToVerify = binary_switchEndian(hashToVerify) # 10. Apply ECDSA signature verification if senderAddr . verifyDERSignature ( toHash , justSig ) : return True else : return False