|
|
@ -93,8 +93,9 @@ static CSignatureCache signatureCache; |
|
|
|
// 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() |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t nMaxCacheSize = GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE) * ((size_t) 1 << 20); |
|
|
|
// nMaxCacheSize is unsigned. If -maxsigcachesize is set to zero,
|
|
|
|
if (nMaxCacheSize <= 0) return; |
|
|
|
// setup_bytes creates the minimum possible cache (2 elements).
|
|
|
|
|
|
|
|
size_t nMaxCacheSize = std::min(std::max((int64_t)0, GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE)), MAX_MAX_SIG_CACHE_SIZE) * ((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 store %zu elements\n", |
|
|
|
LogPrintf("Using %zu MiB out of %zu requested for signature cache, able to store %zu elements\n", |
|
|
|
(nElems*sizeof(uint256)) >>20, nMaxCacheSize>>20, nElems); |
|
|
|
(nElems*sizeof(uint256)) >>20, nMaxCacheSize>>20, nElems); |
|
|
|