Changeset View
Changeset View
Standalone View
Standalone View
src/script/sigcache.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
static CSignatureCache signatureCache; | static CSignatureCache signatureCache; | ||||
} // namespace | } // namespace | ||||
// To be called once in AppInit2/TestingSetup to initialize the signatureCache | // To be called once in AppInit2/TestingSetup to initialize the signatureCache | ||||
void InitSignatureCache() { | void InitSignatureCache() { | ||||
// nMaxCacheSize is unsigned. If -maxsigcachesize is set to zero, | // nMaxCacheSize is unsigned. If -maxsigcachesize is set to zero, | ||||
// 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 " | LogPrintf("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); | ||||
} | } | ||||
Show All 17 Lines |