mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-02 21:37:05 +01:00
versionbits: Add support for delayed activation
Github-Pull: #21377
Rebased-From: 73d4a70639
This commit is contained in:
committed by
Andrew Chow
parent
f9517e6014
commit
4cab84cfdf
@@ -9,6 +9,7 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
|
||||
{
|
||||
int nPeriod = Period(params);
|
||||
int nThreshold = Threshold(params);
|
||||
int min_activation_height = MinActivationHeight(params);
|
||||
int64_t nTimeStart = BeginTime(params);
|
||||
int64_t nTimeTimeout = EndTime(params);
|
||||
|
||||
@@ -78,8 +79,10 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
|
||||
break;
|
||||
}
|
||||
case ThresholdState::LOCKED_IN: {
|
||||
// Always progresses into ACTIVE.
|
||||
stateNext = ThresholdState::ACTIVE;
|
||||
// Progresses into ACTIVE provided activation height will have been reached.
|
||||
if (pindexPrev->nHeight + 1 >= min_activation_height) {
|
||||
stateNext = ThresholdState::ACTIVE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ThresholdState::FAILED:
|
||||
@@ -170,6 +173,7 @@ private:
|
||||
protected:
|
||||
int64_t BeginTime(const Consensus::Params& params) const override { return params.vDeployments[id].nStartTime; }
|
||||
int64_t EndTime(const Consensus::Params& params) const override { return params.vDeployments[id].nTimeout; }
|
||||
int MinActivationHeight(const Consensus::Params& params) const override { return params.vDeployments[id].min_activation_height; }
|
||||
int Period(const Consensus::Params& params) const override { return params.nMinerConfirmationWindow; }
|
||||
int Threshold(const Consensus::Params& params) const override { return params.nRuleChangeActivationThreshold; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user