diff --git a/src/consensus/params.h b/src/consensus/params.h index 1367484386..e7c5f54f68 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -7,6 +7,7 @@ #define BITCOIN_CONSENSUS_PARAMS_H #include +#include #include #include @@ -37,6 +38,11 @@ struct BIP9Deployment { // ELEMENTS: Interpreted as block height! int64_t nTimeout; + // ELEMENTS: allow overriding the signalling period length rather than using `nMinerConfirmationWindow` + Optional nPeriod{nullopt}; + // ELEMENTS: allow overriding the activation threshold rather than using `nRuleChangeActivationThreshold` + Optional nThreshold{nullopt}; + /** Constant for nTimeout very far in the future. */ static constexpr int64_t NO_TIMEOUT = std::numeric_limits::max(); diff --git a/src/versionbits.cpp b/src/versionbits.cpp index 019a830553..24b04834cb 100644 --- a/src/versionbits.cpp +++ b/src/versionbits.cpp @@ -180,8 +180,20 @@ 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 Period(const Consensus::Params& params) const override { return params.nMinerConfirmationWindow; } - int Threshold(const Consensus::Params& params) const override { return params.nRuleChangeActivationThreshold; } + int Period(const Consensus::Params& params) const override { + if (params.vDeployments[id].nPeriod) { + return *params.vDeployments[id].nPeriod; + } else { + return params.nMinerConfirmationWindow; + } + } + int Threshold(const Consensus::Params& params) const override { + if (params.vDeployments[id].nThreshold) { + return *params.vDeployments[id].nThreshold; + } else { + return params.nRuleChangeActivationThreshold; + } + } bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const override {