| 2239 | static VersionBitsCache versionbitscache; |
| 2240 | |
| 2241 | int32_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. |