Bitcoin ABC  0.26.3
P2P Digital Currency
Classes | Functions | Variables
scriptcache.h File Reference
#include <array>
#include <cstdint>
#include <sync.h>
Include dependency graph for scriptcache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ScriptCacheKey
 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 specific set of flags, along with any associated information learned during execution. More...
 

Functions

void InitScriptExecutionCache ()
 Initializes the script-execution cache. More...
 
bool IsKeyInScriptCache (ScriptCacheKey key, bool erase, int &nSigChecksOut) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Check if a given key is in the cache, and if so, return its values. More...
 
void AddKeyInScriptCache (ScriptCacheKey key, int nSigChecks) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Add an entry in the cache. More...
 

Variables

RecursiveMutex cs_main
 Global state. More...
 
static const unsigned int DEFAULT_MAX_SCRIPT_CACHE_SIZE = 32
 
static const int64_t MAX_MAX_SCRIPT_CACHE_SIZE = 16384
 

Function Documentation

◆ AddKeyInScriptCache()

void AddKeyInScriptCache ( ScriptCacheKey  key,
int  nSigChecks 
)

Add an entry in the cache.

Definition at line 120 of file scriptcache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitScriptExecutionCache()

void InitScriptExecutionCache ( )

Initializes the script-execution cache.

Definition at line 76 of file scriptcache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsKeyInScriptCache()

bool IsKeyInScriptCache ( ScriptCacheKey  key,
bool  erase,
int &  nSigChecksOut 
)

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)

Definition at line 109 of file scriptcache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cs_main

RecursiveMutex cs_main
extern

Global state.

Mutex to guard access to validation specific variables, such as reading or changing the chainstate.

This may also need to be locked when updating the transaction pool, e.g. on AcceptToMemoryPool. See CTxMemPool::cs comment for details.

The transaction pool has a separate lock to allow reading from it and the chainstate at the same time.

Definition at line 113 of file validation.cpp.

◆ DEFAULT_MAX_SCRIPT_CACHE_SIZE

const unsigned int DEFAULT_MAX_SCRIPT_CACHE_SIZE = 32
static

Definition at line 48 of file scriptcache.h.

◆ MAX_MAX_SCRIPT_CACHE_SIZE

const int64_t MAX_MAX_SCRIPT_CACHE_SIZE = 16384
static

Definition at line 50 of file scriptcache.h.