Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
VersionBitsCache Class Reference

BIP 9 allows multiple softforks to be deployed in parallel. More...

#include <versionbits.h>

Collaboration diagram for VersionBitsCache:
[legend]

Public Member Functions

ThresholdState State (const CBlockIndex *pindexPrev, const Consensus::Params &params, Consensus::DeploymentPos pos) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
 Get the BIP9 state for a given deployment for the block after pindexPrev. More...
 
int StateSinceHeight (const CBlockIndex *pindexPrev, const Consensus::Params &params, Consensus::DeploymentPos pos) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
 Get the block height at which the BIP9 deployment switched into the state for the block after pindexPrev. More...
 
int32_t ComputeBlockVersion (const CBlockIndex *pindexPrev, const Consensus::Params &params) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
 Determine what nVersion a new block should use. More...
 
void Clear () EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
 

Static Public Member Functions

static BIP9Stats Statistics (const CBlockIndex *pindex, const Consensus::Params &params, Consensus::DeploymentPos pos, std::vector< bool > *signalling_blocks=nullptr)
 Get the numerical statistics for a given deployment for the signalling period that includes pindex. More...
 
static uint32_t Mask (const Consensus::Params &params, Consensus::DeploymentPos pos)
 

Private Member Functions

ThresholdConditionCache m_caches[Consensus::MAX_VERSION_BITS_DEPLOYMENTSGUARDED_BY (m_mutex)
 

Private Attributes

Mutex m_mutex
 

Detailed Description

BIP 9 allows multiple softforks to be deployed in parallel.

We cache per-period state for every one of them.

Definition at line 80 of file versionbits.h.

Member Function Documentation

◆ Clear()

void VersionBitsCache::Clear ( )

Definition at line 241 of file versionbits.cpp.

Here is the caller graph for this function:

◆ ComputeBlockVersion()

int32_t VersionBitsCache::ComputeBlockVersion ( const CBlockIndex pindexPrev,
const Consensus::Params params 
)

Determine what nVersion a new block should use.

Definition at line 225 of file versionbits.cpp.

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

◆ GUARDED_BY()

ThresholdConditionCache m_caches[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] VersionBitsCache::GUARDED_BY ( m_mutex  )
private

◆ Mask()

uint32_t VersionBitsCache::Mask ( const Consensus::Params params,
Consensus::DeploymentPos  pos 
)
static

Definition at line 220 of file versionbits.cpp.

Here is the caller graph for this function:

◆ State()

ThresholdState VersionBitsCache::State ( const CBlockIndex pindexPrev,
const Consensus::Params params,
Consensus::DeploymentPos  pos 
)

Get the BIP9 state for a given deployment for the block after pindexPrev.

Definition at line 203 of file versionbits.cpp.

Here is the caller graph for this function:

◆ StateSinceHeight()

int VersionBitsCache::StateSinceHeight ( const CBlockIndex pindexPrev,
const Consensus::Params params,
Consensus::DeploymentPos  pos 
)

Get the block height at which the BIP9 deployment switched into the state for the block after pindexPrev.

Definition at line 214 of file versionbits.cpp.

Here is the caller graph for this function:

◆ Statistics()

BIP9Stats VersionBitsCache::Statistics ( const CBlockIndex pindex,
const Consensus::Params params,
Consensus::DeploymentPos  pos,
std::vector< bool > *  signalling_blocks = nullptr 
)
static

Get the numerical statistics for a given deployment for the signalling period that includes pindex.

If provided, signalling_blocks is set to true/false based on whether each block in the period signalled

Definition at line 209 of file versionbits.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ m_mutex

Mutex VersionBitsCache::m_mutex
private

Definition at line 83 of file versionbits.h.


The documentation for this class was generated from the following files: