MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / CheckSig

Method CheckSig

src/script/interpreter.cpp:1244–1264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1242}
1243
1244bool TransactionSignatureChecker::CheckSig(const vector<unsigned char>& vchSigIn, const vector<unsigned char>& vchPubKey,
1245 const CScript& scriptCode, unsigned int flags) const
1246{
1247 CPubKey pubkey(vchPubKey);
1248 if (!pubkey.IsValid())
1249 return false;
1250
1251 // Hash type is one byte tacked on to the end of the signature
1252 vector<unsigned char> vchSig(vchSigIn);
1253 if (vchSig.empty())
1254 return false;
1255 uint32_t nHashType = GetHashType(vchSig);
1256 vchSig.pop_back();
1257
1258 uint256 sighash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, flags);
1259
1260 if (!VerifySignature(vchSig, pubkey, sighash))
1261 return false;
1262
1263 return true;
1264}
1265
1266bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) const
1267{

Callers 2

EvalScriptFunction · 0.45
BOOST_FOREACHFunction · 0.45

Calls 4

GetHashTypeFunction · 0.85
SignatureHashFunction · 0.70
IsValidMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected