aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-06-30 23:10:55 -0400
committerCarl Dong <contact@carldong.me>2022-08-03 12:02:31 -0400
commit08dbc6ef72db48168dc03991f5f838dae42c8dfd (patch)
treef78f5551eea5874f068a05f3bbab1a9563f01493 /src/init.cpp
parent0dbce4b1034b53d19b88af332385a006098b6d48 (diff)
downloadbitcoin-08dbc6ef72db48168dc03991f5f838dae42c8dfd.tar.xz
cuckoocache: Return approximate memory size
Returning the approximate total size eliminates the need for InitS*Cache() to do nElems*sizeof(uint256). The cuckoocache has a better idea of this information.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index e3d13ad972..53139924b6 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1115,8 +1115,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
args.GetArg("-datadir", ""), fs::PathToString(fs::current_path()));
}
- InitSignatureCache();
- InitScriptExecutionCache();
+ if (!InitSignatureCache() || !InitScriptExecutionCache()) {
+ return InitError(strprintf(_("Unable to allocate memory for -maxsigcachesize: '%s' MiB"), args.GetIntArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE)));
+ }
int script_threads = args.GetIntArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
if (script_threads <= 0) {