@@ -132,7 +132,7 @@ bool IsCanonicalSignature(const valtype &vchSig, unsigned int flags) {
132132 return true ;
133133}
134134
135- bool EvalScript (vector<vector<unsigned char > >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType )
135+ bool EvalScript (vector<vector<unsigned char > >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, unsigned int flags)
136136{
137137 CScript::const_iterator pc = script.begin ();
138138 CScript::const_iterator pend = script.end ();
@@ -675,7 +675,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
675675 scriptCode.FindAndDelete (CScript (vchSig));
676676
677677 bool fSuccess = IsCanonicalSignature (vchSig, flags) && IsCanonicalPubKey (vchPubKey, flags) &&
678- CheckSig (vchSig, vchPubKey, scriptCode, txTo, nIn, nHashType, flags);
678+ CheckSig (vchSig, vchPubKey, scriptCode, txTo, nIn, flags);
679679
680680 popstack (stack);
681681 popstack (stack);
@@ -736,7 +736,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
736736
737737 // Check signature
738738 bool fOk = IsCanonicalSignature (vchSig, flags) && IsCanonicalPubKey (vchPubKey, flags) &&
739- CheckSig (vchSig, vchPubKey, scriptCode, txTo, nIn, nHashType, flags);
739+ CheckSig (vchSig, vchPubKey, scriptCode, txTo, nIn, flags);
740740
741741 if (fOk ) {
742742 isig++;
@@ -975,7 +975,7 @@ class CSignatureCache
975975 }
976976};
977977
978- bool CheckSig (vector<unsigned char > vchSig, const vector<unsigned char > & vchPubKey, const CScript & scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType , int flags)
978+ bool CheckSig (vector<unsigned char > vchSig, const vector<unsigned char >& vchPubKey, const CScript& scriptCode, const CTransaction& txTo, unsigned int nIn, int flags)
979979{
980980 static CSignatureCache signatureCache;
981981
@@ -986,10 +986,7 @@ bool CheckSig(vector<unsigned char> vchSig, const vector<unsigned char> &vchPubK
986986 // Hash type is one byte tacked on to the end of the signature
987987 if (vchSig.empty ())
988988 return false ;
989- if (nHashType == 0 )
990- nHashType = vchSig.back ();
991- else if (nHashType != vchSig.back ())
992- return false ;
989+ int nHashType = vchSig.back ();
993990 vchSig.pop_back ();
994991
995992 uint256 sighash = SignatureHash (scriptCode, txTo, nIn, nHashType);
@@ -1006,15 +1003,14 @@ bool CheckSig(vector<unsigned char> vchSig, const vector<unsigned char> &vchPubK
10061003 return true ;
10071004}
10081005
1009- bool VerifyScript (const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn,
1010- unsigned int flags, int nHashType)
1006+ bool VerifyScript (const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, unsigned int flags)
10111007{
10121008 vector<vector<unsigned char > > stack, stackCopy;
1013- if (!EvalScript (stack, scriptSig, txTo, nIn, flags, nHashType ))
1009+ if (!EvalScript (stack, scriptSig, txTo, nIn, flags))
10141010 return false ;
10151011 if (flags & SCRIPT_VERIFY_P2SH)
10161012 stackCopy = stack;
1017- if (!EvalScript (stack, scriptPubKey, txTo, nIn, flags, nHashType ))
1013+ if (!EvalScript (stack, scriptPubKey, txTo, nIn, flags))
10181014 return false ;
10191015 if (stack.empty ())
10201016 return false ;
@@ -1037,7 +1033,7 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C
10371033 CScript pubKey2 (pubKeySerialized.begin (), pubKeySerialized.end ());
10381034 popstack (stackCopy);
10391035
1040- if (!EvalScript (stackCopy, pubKey2, txTo, nIn, flags, nHashType ))
1036+ if (!EvalScript (stackCopy, pubKey2, txTo, nIn, flags))
10411037 return false ;
10421038 if (stackCopy.empty ())
10431039 return false ;
0 commit comments