Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,772 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
class WarningBitsConditionChecker : public AbstractThresholdConditionChecker { | class WarningBitsConditionChecker : public AbstractThresholdConditionChecker { | ||||
private: | private: | ||||
int bit; | int bit; | ||||
public: | public: | ||||
WarningBitsConditionChecker(int bitIn) : bit(bitIn) {} | WarningBitsConditionChecker(int bitIn) : bit(bitIn) {} | ||||
int64_t BeginTime(const Consensus::Params ¶ms) const { return 0; } | int64_t BeginTime(const Consensus::Params ¶ms) const override { | ||||
int64_t EndTime(const Consensus::Params ¶ms) const { | return 0; | ||||
} | |||||
int64_t EndTime(const Consensus::Params ¶ms) const override { | |||||
return std::numeric_limits<int64_t>::max(); | return std::numeric_limits<int64_t>::max(); | ||||
} | } | ||||
int Period(const Consensus::Params ¶ms) const { | int Period(const Consensus::Params ¶ms) const override { | ||||
return params.nMinerConfirmationWindow; | return params.nMinerConfirmationWindow; | ||||
} | } | ||||
int Threshold(const Consensus::Params ¶ms) const { | int Threshold(const Consensus::Params ¶ms) const override { | ||||
return params.nRuleChangeActivationThreshold; | return params.nRuleChangeActivationThreshold; | ||||
} | } | ||||
bool Condition(const CBlockIndex *pindex, | bool Condition(const CBlockIndex *pindex, | ||||
const Consensus::Params ¶ms) const { | const Consensus::Params ¶ms) const override { | ||||
return ((pindex->nVersion & VERSIONBITS_TOP_MASK) == | return ((pindex->nVersion & VERSIONBITS_TOP_MASK) == | ||||
VERSIONBITS_TOP_BITS) && | VERSIONBITS_TOP_BITS) && | ||||
((pindex->nVersion >> bit) & 1) != 0 && | ((pindex->nVersion >> bit) & 1) != 0 && | ||||
((ComputeBlockVersion(pindex->pprev, params) >> bit) & 1) == 0; | ((ComputeBlockVersion(pindex->pprev, params) >> bit) & 1) == 0; | ||||
} | } | ||||
}; | }; | ||||
// Protected by cs_main | // Protected by cs_main | ||||
▲ Show 20 Lines • Show All 3,271 Lines • Show Last 20 Lines |