From 08dbc6ef72db48168dc03991f5f838dae42c8dfd Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Thu, 30 Jun 2022 23:10:55 -0400 Subject: 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. --- src/init.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/init.cpp') 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) { -- cgit v1.2.3