* Class to implement versionbits logic. */
| 168 | * Class to implement versionbits logic. |
| 169 | */ |
| 170 | class VersionBitsConditionChecker : public AbstractThresholdConditionChecker { |
| 171 | private: |
| 172 | const Consensus::DeploymentPos id; |
| 173 | |
| 174 | protected: |
| 175 | int64_t BeginTime(const Consensus::Params& params) const { return params.vDeployments[id].nStartTime; } |
| 176 | int64_t EndTime(const Consensus::Params& params) const { return params.vDeployments[id].nTimeout; } |
| 177 | int Period(const Consensus::Params& params) const { return params.nMinerConfirmationWindow; } |
| 178 | int Threshold(const Consensus::Params& params) const { return params.nRuleChangeActivationThreshold; } |
| 179 | |
| 180 | bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const |
| 181 | { |
| 182 | return (((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) && (pindex->nVersion & Mask(params)) != 0); |
| 183 | } |
| 184 | |
| 185 | public: |
| 186 | VersionBitsConditionChecker(Consensus::DeploymentPos id_) : id(id_) {} |
| 187 | uint32_t Mask(const Consensus::Params& params) const { return ((uint32_t)1) << params.vDeployments[id].bit; } |
| 188 | }; |
| 189 | |
| 190 | } |
| 191 |
no outgoing calls
no test coverage detected