Changeset View
Changeset View
Standalone View
Standalone View
src/test/versionbits_tests.cpp
Show All 19 Lines | |||||
static const Consensus::Params paramsDummy = Consensus::Params(); | static const Consensus::Params paramsDummy = Consensus::Params(); | ||||
class TestConditionChecker : public AbstractThresholdConditionChecker { | class TestConditionChecker : public AbstractThresholdConditionChecker { | ||||
private: | private: | ||||
mutable ThresholdConditionCache cache; | mutable ThresholdConditionCache cache; | ||||
public: | public: | ||||
int64_t BeginTime(const Consensus::Params ¶ms) const { | int64_t BeginTime(const Consensus::Params ¶ms) const override { | ||||
return TestTime(10000); | return TestTime(10000); | ||||
} | } | ||||
int64_t EndTime(const Consensus::Params ¶ms) const { | int64_t EndTime(const Consensus::Params ¶ms) const override { | ||||
return TestTime(20000); | return TestTime(20000); | ||||
} | } | ||||
int Period(const Consensus::Params ¶ms) const { return 1000; } | int Period(const Consensus::Params ¶ms) const override { return 1000; } | ||||
int Threshold(const Consensus::Params ¶ms) const { return 900; } | int Threshold(const Consensus::Params ¶ms) const override { | ||||
return 900; | |||||
} | |||||
bool Condition(const CBlockIndex *pindex, | bool Condition(const CBlockIndex *pindex, | ||||
const Consensus::Params ¶ms) const { | const Consensus::Params ¶ms) const override { | ||||
return (pindex->nVersion & 0x100); | return (pindex->nVersion & 0x100); | ||||
} | } | ||||
ThresholdState GetStateFor(const CBlockIndex *pindexPrev) const { | ThresholdState GetStateFor(const CBlockIndex *pindexPrev) const { | ||||
return AbstractThresholdConditionChecker::GetStateFor( | return AbstractThresholdConditionChecker::GetStateFor( | ||||
pindexPrev, paramsDummy, cache); | pindexPrev, paramsDummy, cache); | ||||
} | } | ||||
int GetStateSinceHeightFor(const CBlockIndex *pindexPrev) const { | int GetStateSinceHeightFor(const CBlockIndex *pindexPrev) const { | ||||
▲ Show 20 Lines • Show All 492 Lines • Show Last 20 Lines |