* Class to implement versionbits logic. */
| 94 | * Class to implement versionbits logic. |
| 95 | */ |
| 96 | class VersionBitsConditionChecker : public AbstractThresholdConditionChecker { |
| 97 | private: |
| 98 | const Consensus::DeploymentPos id; |
| 99 | |
| 100 | protected: |
| 101 | int64_t BeginTime(const Consensus::Params& params) const { return params.vDeployments[id].nStartTime; } |
| 102 | int64_t EndTime(const Consensus::Params& params) const { return params.vDeployments[id].nTimeout; } |
| 103 | int Period(const Consensus::Params& params) const { return params.nMinerConfirmationWindow; } |
| 104 | int Threshold(const Consensus::Params& params) const { return params.nRuleChangeActivationThreshold; } |
| 105 | |
| 106 | bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const |
| 107 | { |
| 108 | return (((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) && (pindex->nVersion & Mask(params)) != 0); |
| 109 | } |
| 110 | |
| 111 | public: |
| 112 | VersionBitsConditionChecker(Consensus::DeploymentPos id_) : id(id_) {} |
| 113 | uint32_t Mask(const Consensus::Params& params) const { return ((uint32_t)1) << params.vDeployments[id].bit; } |
| 114 | }; |
| 115 | |
| 116 | } |
| 117 |
no outgoing calls
no test coverage detected