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

Function ComputeBlockVersion

src/validation.cpp:1736–1749  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1734VersionBitsCache versionbitscache;
1735
1736int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Params& params)
1737{
1738 LOCK(cs_main);
1739 int32_t nVersion = VERSIONBITS_TOP_BITS;
1740
1741 for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) {
1742 ThresholdState state = VersionBitsState(pindexPrev, params, static_cast<Consensus::DeploymentPos>(i), versionbitscache);
1743 if (state == ThresholdState::LOCKED_IN || state == ThresholdState::STARTED) {
1744 nVersion |= VersionBitsMask(params, static_cast<Consensus::DeploymentPos>(i));
1745 }
1746 }
1747
1748 return nVersion;
1749}
1750
1751/**
1752 * Threshold condition checker that triggers when unknown versionbits are seen on the network.

Callers 4

CreateNewBlockMethod · 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