Changeset View
Changeset View
Standalone View
Standalone View
src/script/scriptcache.h
// 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. | ||||
#ifndef BITCOIN_SCRIPT_SCRIPTCACHE_H | #ifndef BITCOIN_SCRIPT_SCRIPTCACHE_H | ||||
#define BITCOIN_SCRIPT_SCRIPTCACHE_H | #define BITCOIN_SCRIPT_SCRIPTCACHE_H | ||||
#include <array> | #include <array> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <sync.h> | |||||
// Actually declared in validation.cpp; can't include because of circular | |||||
// dependency. | |||||
extern RecursiveMutex cs_main; | |||||
class CTransaction; | class CTransaction; | ||||
/** | /** | ||||
* The script cache is a map using a key/value element, that caches the | * The script cache is a map using a key/value element, that caches the | ||||
* success of executing a specific transaction's input scripts under a | * success of executing a specific transaction's input scripts under a | ||||
* specific set of flags, along with any associated information learned | * specific set of flags, along with any associated information learned | ||||
* during execution. | * during execution. | ||||
* | * | ||||
Show All 24 Lines | |||||
/** Initializes the script-execution cache */ | /** Initializes the script-execution cache */ | ||||
void InitScriptExecutionCache(); | void InitScriptExecutionCache(); | ||||
/** | /** | ||||
* Check if a given key is in the cache, and if so, return its values. | * Check if a given key is in the cache, and if so, return its values. | ||||
* (if not found, nSigChecks may or may not be set to an arbitrary value) | * (if not found, nSigChecks may or may not be set to an arbitrary value) | ||||
*/ | */ | ||||
bool IsKeyInScriptCache(ScriptCacheKey key, bool erase, int &nSigChecksOut); | bool IsKeyInScriptCache(ScriptCacheKey key, bool erase, int &nSigChecksOut) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | |||||
/** | /** | ||||
* Add an entry in the cache. | * Add an entry in the cache. | ||||
*/ | */ | ||||
void AddKeyInScriptCache(ScriptCacheKey key, int nSigChecks); | void AddKeyInScriptCache(ScriptCacheKey key, int nSigChecks) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | |||||
#endif // BITCOIN_SCRIPT_SCRIPTCACHE_H | #endif // BITCOIN_SCRIPT_SCRIPTCACHE_H |