Changeset View
Changeset View
Standalone View
Standalone View
src/script/sigcache.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | void InitSignatureCache() { | ||||
// setup_bytes creates the minimum possible cache (2 elements). | // setup_bytes creates the minimum possible cache (2 elements). | ||||
size_t nMaxCacheSize = | size_t nMaxCacheSize = | ||||
std::min(std::max(int64_t(0), | std::min(std::max(int64_t(0), | ||||
gArgs.GetArg("-maxsigcachesize", | gArgs.GetArg("-maxsigcachesize", | ||||
DEFAULT_MAX_SIG_CACHE_SIZE)), | DEFAULT_MAX_SIG_CACHE_SIZE)), | ||||
MAX_MAX_SIG_CACHE_SIZE) * | MAX_MAX_SIG_CACHE_SIZE) * | ||||
(size_t(1) << 20); | (size_t(1) << 20); | ||||
size_t nElems = signatureCache.setup_bytes(nMaxCacheSize); | size_t nElems = signatureCache.setup_bytes(nMaxCacheSize); | ||||
LogPrintf("Using %zu MiB out of %zu requested for signature cache, able to " | LogPrint(BCLog::SCRIPT, | ||||
"Using %zu MiB out of %zu requested for signature cache, able to " | |||||
"store %zu elements\n", | "store %zu elements\n", | ||||
(nElems * sizeof(uint256)) >> 20, nMaxCacheSize >> 20, nElems); | (nElems * sizeof(uint256)) >> 20, nMaxCacheSize >> 20, nElems); | ||||
} | } | ||||
bool CachingTransactionSignatureChecker::VerifySignature( | bool CachingTransactionSignatureChecker::VerifySignature( | ||||
const std::vector<uint8_t> &vchSig, const CPubKey &pubkey, | const std::vector<uint8_t> &vchSig, const CPubKey &pubkey, | ||||
const uint256 &sighash) const { | const uint256 &sighash) const { | ||||
uint256 entry; | uint256 entry; | ||||
signatureCache.ComputeEntry(entry, sighash, vchSig, pubkey); | signatureCache.ComputeEntry(entry, sighash, vchSig, pubkey); | ||||
if (signatureCache.Get(entry, !store)) { | if (signatureCache.Get(entry, !store)) { | ||||
Show All 11 Lines |