| 1734 | VersionBitsCache versionbitscache; |
| 1735 | |
| 1736 | int32_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. |