aboutsummaryrefslogtreecommitdiff
path: root/src/script/sigcache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/sigcache.cpp')
-rw-r--r--src/script/sigcache.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp
index 43b594f3cb..507754ad7d 100644
--- a/src/script/sigcache.cpp
+++ b/src/script/sigcache.cpp
@@ -14,6 +14,7 @@
#include <algorithm>
#include <mutex>
+#include <optional>
#include <shared_mutex>
#include <vector>
@@ -75,7 +76,7 @@ public:
std::unique_lock<std::shared_mutex> lock(cs_sigcache);
setValid.insert(entry);
}
- std::pair<uint32_t, size_t> setup_bytes(size_t n)
+ std::optional<std::pair<uint32_t, size_t>> setup_bytes(size_t n)
{
return setValid.setup_bytes(n);
}
@@ -99,8 +100,9 @@ bool InitSignatureCache()
size_t nMaxCacheSize = std::max((int64_t)0, gArgs.GetIntArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_SIZE) / 2) * ((size_t) 1 << 20);
auto setup_results = signatureCache.setup_bytes(nMaxCacheSize);
+ if (!setup_results) return false;
- const auto [num_elems, approx_size_bytes] = setup_results;
+ const auto [num_elems, approx_size_bytes] = *setup_results;
LogPrintf("Using %zu MiB out of %zu/2 requested for signature cache, able to store %zu elements\n",
approx_size_bytes >> 20, (nMaxCacheSize * 2) >> 20, num_elems);
return true;