From 73d4a706393e6dbd6b6d6b6428f8d3233ac0a2d8 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Sat, 6 Mar 2021 18:18:49 +1000 Subject: versionbits: Add support for delayed activation --- src/rpc/blockchain.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/rpc/blockchain.cpp') diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 3ba2fa46ae..acf2f5d6b4 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1258,6 +1258,7 @@ static void BIP9SoftForkDescPushBack(UniValue& softforks, const std::string &nam statsUV.pushKV("possible", statsStruct.possible); bip9.pushKV("statistics", statsUV); } + bip9.pushKV("min_activation_height", consensusParams.vDeployments[id].min_activation_height); UniValue rv(UniValue::VOBJ); rv.pushKV("type", "bip9"); @@ -1304,6 +1305,7 @@ RPCHelpMan getblockchaininfo() {RPCResult::Type::NUM_TIME, "start_time", "the minimum median time past of a block at which the bit gains its meaning"}, {RPCResult::Type::NUM_TIME, "timeout", "the median time past of a block at which the deployment is considered failed if not yet locked in"}, {RPCResult::Type::NUM, "since", "height of the first block to which the status applies"}, + {RPCResult::Type::NUM, "min_activation_height", "minimum height of blocks for which the rules may be enforced"}, {RPCResult::Type::OBJ, "statistics", "numeric statistics about BIP9 signalling for a softfork (only for \"started\" status)", { {RPCResult::Type::NUM, "period", "the length in blocks of the BIP9 signalling period"}, -- cgit v1.2.3 From 55ac5f568a3b73d6f1ef4654617fb76e8bcbccdf Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Sat, 27 Mar 2021 23:00:14 +1000 Subject: versionbits: Add explicit NEVER_ACTIVE deployments Previously we used deployments that would timeout prior to Bitcoin's invention, which allowed the deployment to still be activated in unit tests. This switches those deployments to be truly never active. --- src/rpc/blockchain.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/rpc/blockchain.cpp') diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index acf2f5d6b4..1130a384e5 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1225,10 +1225,8 @@ static void BuriedForkDescPushBack(UniValue& softforks, const std::string &name, static void BIP9SoftForkDescPushBack(UniValue& softforks, const std::string &name, const Consensus::Params& consensusParams, Consensus::DeploymentPos id) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { // For BIP9 deployments. - // Deployments (e.g. testdummy) with timeout value before Jan 1, 2009 are hidden. - // A timeout value of 0 guarantees a softfork will never be activated. - // This is used when merging logic to implement a proposed softfork without a specified deployment schedule. - if (consensusParams.vDeployments[id].nTimeout <= 1230768000) return; + // Deployments that are never active are hidden. + if (consensusParams.vDeployments[id].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) return; UniValue bip9(UniValue::VOBJ); const ThresholdState thresholdState = VersionBitsState(::ChainActive().Tip(), consensusParams, id, versionbitscache); -- cgit v1.2.3