MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / ComputeBlockVersion

Function ComputeBlockVersion

src/main.cpp:2241–2254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2239static VersionBitsCache versionbitscache;
2240
2241int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Params& params)
2242{
2243 LOCK(cs_main);
2244 int32_t nVersion = VERSIONBITS_TOP_BITS;
2245
2246 for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) {
2247 ThresholdState state = VersionBitsState(pindexPrev, params, (Consensus::DeploymentPos)i, versionbitscache);
2248 if (state == THRESHOLD_LOCKED_IN || state == THRESHOLD_STARTED) {
2249 nVersion |= VersionBitsMask(params, (Consensus::DeploymentPos)i);
2250 }
2251 }
2252
2253 return nVersion;
2254}
2255
2256/**
2257 * Threshold condition checker that triggers when unknown versionbits are seen on the network.

Callers 4

CreateNewBlockFunction · 0.85
ConditionMethod · 0.85
UpdateTipFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 2

VersionBitsStateFunction · 0.85
VersionBitsMaskFunction · 0.85

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68