MCPcopy Create free account
hub / github.com/LUX-Core/lux / ComputeBlockVersion

Function ComputeBlockVersion

src/main.cpp:2622–2642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2620VersionBitsCache versionbitscache;
2621
2622int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Params& params)
2623{
2624 //LOCK(cs_main);
2625 int32_t nVersion = VERSIONBITS_TOP_BITS;
2626
2627 for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) {
2628 ThresholdState state = VersionBitsState(pindexPrev, params, (Consensus::DeploymentPos)i, versionbitscache);
2629 if ((Consensus::DeploymentPos)i == Consensus::SMART_CONTRACTS_HARDFORK) {
2630 int nextHeight = pindexPrev != nullptr ? pindexPrev->nHeight + 1 : 1;
2631 if (nextHeight >= Params().FirstSCBlock()) {
2632 nVersion |= VersionBitsMask(params, (Consensus::DeploymentPos)i);
2633 }
2634 } else {
2635 if (state == THRESHOLD_LOCKED_IN || state == THRESHOLD_STARTED) {
2636 nVersion |= VersionBitsMask(params, (Consensus::DeploymentPos)i);
2637 }
2638 }
2639 }
2640
2641 return nVersion;
2642}
2643
2644/**
2645 * Threshold condition checker that triggers when unknown versionbits are seen on the network.

Callers 3

CreateNewBlockMethod · 0.85
ConditionMethod · 0.85
UpdateTipFunction · 0.85

Calls 4

VersionBitsStateFunction · 0.85
VersionBitsMaskFunction · 0.85
FirstSCBlockMethod · 0.80
ParamsClass · 0.70

Tested by

no test coverage detected