mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
consensus/params: Move version bits period/threshold to bip9 param
Rather than having the rule change period/threshold be constant for all potential deployments on a chain, have it be specific to the deployment itself. This both matches history (BIP 9 specified a 2016 block period and 1916 block threshold; BIP 91 specified a 336 block period and 269 block threshold; and BIP 341 specified a 2016 block period and 1815 block threshold), and allows the code to be simplified, as only the BIP9Deployment structure is needed, not the full Consensus::Params structure.
This commit is contained in:
@@ -2378,8 +2378,20 @@ public:
|
||||
|
||||
int64_t BeginTime() const override { return 0; }
|
||||
int64_t EndTime() const override { return std::numeric_limits<int64_t>::max(); }
|
||||
int Period() const override { return m_chainman.GetConsensus().nMinerConfirmationWindow; }
|
||||
int Threshold() const override { return m_chainman.GetConsensus().nRuleChangeActivationThreshold; }
|
||||
int Period() const override {
|
||||
if (m_chainman.GetParams().IsTestChain()) {
|
||||
return m_chainman.GetConsensus().DifficultyAdjustmentInterval();
|
||||
} else {
|
||||
return 2016;
|
||||
}
|
||||
}
|
||||
int Threshold() const override {
|
||||
if (m_chainman.GetParams().IsTestChain()) {
|
||||
return m_chainman.GetConsensus().DifficultyAdjustmentInterval() * 3 / 4; // 75% for test nets per BIP9 suggestion
|
||||
} else {
|
||||
return 1815; // 90% threshold used in BIP 341
|
||||
}
|
||||
}
|
||||
|
||||
bool Condition(const CBlockIndex* pindex) const override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user