mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
reduce cache sizes so that default maxsigcache size is same as Bitcoin
Bitcoin allocates 32M for signature caching by default, split between a signature cache and a script validity cache (see Core #10192). Since 0.14 we have added an additional 32M for rangeproof caching *and* an additional 32M for surjectionproof caching. These cache entries cost a bit over 32 bytes, so these are room for a million entries....or 4Gb of rangeproofs and 300M of surjection proofs. Presumably we did not intend to triple memory usage relative to Core to deal with some champagne problem in which our mempool is overfilled ten times with pure rangeproofs. So put the total default cache size back to 32M. This should have no performance hit under realistic circumstances and should reduce CI OOM failures. On my system we now use 50M rather than 110M during the fedpeg test; we still use 18M that Core does not by having three additional global secp contexts (one in blind.cpp, one in pegins.cpp, one in confidential_validation.cpp) but we can settle that in a future commit.
This commit is contained in:
parent
1670bdfa0b
commit
e5ecee8d2d
2 changed files with 8 additions and 8 deletions
|
|
@ -115,9 +115,9 @@ void InitSignatureCache()
|
|||
{
|
||||
// nMaxCacheSize is unsigned. If -maxsigcachesize is set to zero,
|
||||
// setup_bytes creates the minimum possible cache (2 elements).
|
||||
size_t nMaxCacheSize = std::min(std::max((int64_t)0, gArgs.GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE) / 2), MAX_MAX_SIG_CACHE_SIZE) * ((size_t) 1 << 20);
|
||||
size_t nMaxCacheSize = std::min(std::max((int64_t)0, gArgs.GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE) / 4), MAX_MAX_SIG_CACHE_SIZE) * ((size_t) 1 << 20);
|
||||
size_t nElems = signatureCache.setup_bytes(nMaxCacheSize);
|
||||
LogPrintf("Using %zu MiB out of %zu/2 requested for signature cache, able to store %zu elements\n",
|
||||
LogPrintf("Using %zu MiB out of %zu/4 requested for signature cache, able to store %zu elements\n",
|
||||
(nElems*sizeof(uint256)) >>20, (nMaxCacheSize*2)>>20, nElems);
|
||||
}
|
||||
|
||||
|
|
@ -152,9 +152,9 @@ void InitRangeproofCache()
|
|||
{
|
||||
// nMaxCacheSize is unsigned. If -maxsigcachesize is set to zero,
|
||||
// setup_bytes creates the minimum possible cache (2 elements).
|
||||
size_t nMaxCacheSize = std::min(std::max((int64_t)0, gArgs.GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE)), MAX_MAX_SIG_CACHE_SIZE) * ((size_t) 1 << 20);
|
||||
size_t nMaxCacheSize = std::min(std::max((int64_t)0, gArgs.GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE) / 4), MAX_MAX_SIG_CACHE_SIZE) * ((size_t) 1 << 20);
|
||||
size_t nElems = rangeProofCache.setup_bytes(nMaxCacheSize);
|
||||
LogPrintf("Using %zu MiB out of %zu requested for rangeproof cache, able to store %zu elements\n",
|
||||
LogPrintf("Using %zu MiB out of %zu/4 requested for rangeproof cache, able to store %zu elements\n",
|
||||
(nElems*sizeof(uint256)) >>20, nMaxCacheSize>>20, nElems);
|
||||
}
|
||||
|
||||
|
|
@ -163,9 +163,9 @@ void InitSurjectionproofCache()
|
|||
{
|
||||
// nMaxCacheSize is unsigned. If -maxsigcachesize is set to zero,
|
||||
// setup_bytes creates the minimum possible cache (2 elements).
|
||||
size_t nMaxCacheSize = std::min(std::max((int64_t)0, gArgs.GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE)), MAX_MAX_SIG_CACHE_SIZE) * ((size_t) 1 << 20);
|
||||
size_t nMaxCacheSize = std::min(std::max((int64_t)0, gArgs.GetArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE) / 4), MAX_MAX_SIG_CACHE_SIZE) * ((size_t) 1 << 20);
|
||||
size_t nElems = surjectionProofCache.setup_bytes(nMaxCacheSize);
|
||||
LogPrintf("Using %zu MiB out of %zu requested for surjectionproof cache, able to store %zu elements\n",
|
||||
LogPrintf("Using %zu MiB out of %zu/4 requested for surjectionproof cache, able to store %zu elements\n",
|
||||
(nElems*sizeof(uint256)) >>20, nMaxCacheSize>>20, nElems);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue