mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-28 16:36:04 +01:00
validationcaches: Add and use ValidationCacheSizes
Also:
- Make DEFAULT_MAX_SIG_CACHE_SIZE into constexpr
DEFAULT_MAX_SIG_CACHE_BYTES to utilize the compile-time integer
arithmetic overflow checking available to constexpr.
- Fix comment (MiB instead of MB) for DEFAULT_MAX_SIG_CACHE_BYTES.
- Pass in max_size_bytes parameter to InitS*Cache(), modify log line to
no longer allude to maxsigcachesize being split evenly between the two
validation caches.
- Fix possible integer truncation and add a comment.
[META] I've kept the integer types as int64_t in order to not introduce
unintended behaviour changes, in the next commit we will make
them size_t.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <kernel/checks.h>
|
||||
#include <kernel/context.h>
|
||||
#include <kernel/validation_cache_sizes.h>
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <consensus/validation.h>
|
||||
@@ -62,8 +63,9 @@ int main(int argc, char* argv[])
|
||||
// Necessary for CheckInputScripts (eventually called by ProcessNewBlock),
|
||||
// which will try the script cache first and fall back to actually
|
||||
// performing the check with the signature cache.
|
||||
Assert(InitSignatureCache());
|
||||
Assert(InitScriptExecutionCache());
|
||||
kernel::ValidationCacheSizes validation_cache_sizes{};
|
||||
Assert(InitSignatureCache(validation_cache_sizes.signature_cache_bytes));
|
||||
Assert(InitScriptExecutionCache(validation_cache_sizes.script_execution_cache_bytes));
|
||||
|
||||
|
||||
// SETUP: Scheduling and Background Signals
|
||||
|
||||
Reference in New Issue
Block a user