Changeset View
Changeset View
Standalone View
Standalone View
src/script/scriptcache.cpp
// Copyright (c) 2017 The Bitcoin developers | // Copyright (c) 2017 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <script/scriptcache.h> | #include <script/scriptcache.h> | ||||
#include <crypto/sha256.h> | #include <crypto/sha256.h> | ||||
#include <cuckoocache.h> | #include <cuckoocache.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <random.h> | #include <random.h> | ||||
#include <script/sigcache.h> | #include <script/sigcache.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
static CuckooCache::cache<uint256, SignatureCacheHasher> scriptExecutionCache; | static CuckooCache::cache<CuckooCache::KeyOnly<uint256>, SignatureCacheHasher> | ||||
scriptExecutionCache; | |||||
static uint256 scriptExecutionCacheNonce(GetRandHash()); | static uint256 scriptExecutionCacheNonce(GetRandHash()); | ||||
void InitScriptExecutionCache() { | void InitScriptExecutionCache() { | ||||
// nMaxCacheSize is unsigned. If -maxscriptcachesize is set to zero, | // nMaxCacheSize is unsigned. If -maxscriptcachesize is set to zero, | ||||
// setup_bytes creates the minimum possible cache (2 elements). | // setup_bytes creates the minimum possible cache (2 elements). | ||||
size_t nMaxCacheSize = | size_t nMaxCacheSize = | ||||
std::min( | std::min( | ||||
std::max(int64_t(0), gArgs.GetArg("-maxscriptcachesize", | std::max(int64_t(0), gArgs.GetArg("-maxscriptcachesize", | ||||
Show All 37 Lines |