add tests for SIGHASH_FORKID
This commit is contained in:
parent
23eb4a5bbe
commit
8041223c76
|
@ -99,6 +99,17 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, int flags, bo
|
|||
stream << tx2;
|
||||
BOOST_CHECK_MESSAGE(zcashconsensus_verify_script(begin_ptr(scriptPubKey), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, flags, NULL) == expect,message);
|
||||
#endif
|
||||
|
||||
// exercise the FORKID hashtype requirement
|
||||
opcodetype op;
|
||||
auto back = scriptPubKey.end() - 1;
|
||||
if(scriptPubKey.GetOp(back, op) &&
|
||||
op >= OP_CHECKSIG && op <= OP_CHECKSIGVERIFY) {
|
||||
if(expect && scriptPubKey.GetSigOpCount(scriptSig) > 0) {
|
||||
BOOST_CHECK_MESSAGE(!VerifyScript(scriptSig, scriptPubKey, flags | SCRIPT_VERIFY_FORKID, MutableTransactionSignatureChecker(&tx, 0), &err), "FORKID" + message);
|
||||
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_SIG_HASHTYPE, std::string(ScriptErrorString(err)) + ": " + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void static NegateSignatureS(std::vector<unsigned char>& vchSig) {
|
||||
|
|
Loading…
Reference in New Issue