Skip to content

Commit 5a06ebb

Browse files
committed
Merge #8258: RPC: Hide softfork if timeout is 0
409f833 RPC: Hide softfork if timeout is 0 (jl2012)
2 parents 1922e5a + 409f833 commit 5a06ebb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/rpc/blockchain.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,15 @@ static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Conse
866866
return rv;
867867
}
868868

869+
void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const std::string &name, const Consensus::Params& consensusParams, Consensus::DeploymentPos id)
870+
{
871+
// Deployments with timeout value of 0 are hidden.
872+
// A timeout value of 0 guarantees a softfork will never be activated.
873+
// This is used when softfork codes are merged without specifying the deployment schedule.
874+
if (consensusParams.vDeployments[id].nTimeout > 0)
875+
bip9_softforks.push_back(Pair(name, BIP9SoftForkDesc(consensusParams, id)));
876+
}
877+
869878
UniValue getblockchaininfo(const UniValue& params, bool fHelp)
870879
{
871880
if (fHelp || params.size() != 0)
@@ -899,7 +908,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
899908
" ],\n"
900909
" \"bip9_softforks\": { (object) status of BIP9 softforks in progress\n"
901910
" \"xxxx\" : { (string) name of the softfork\n"
902-
" \"status\": \"xxxx\", (string) one of \"defined\", \"started\", \"lockedin\", \"active\", \"failed\"\n"
911+
" \"status\": \"xxxx\", (string) one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\"\n"
903912
" \"bit\": xx, (numeric) the bit, 0-28, in the block version field used to signal this soft fork\n"
904913
" \"startTime\": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n"
905914
" \"timeout\": xx (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n"
@@ -931,8 +940,8 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
931940
softforks.push_back(SoftForkDesc("bip34", 2, tip, consensusParams));
932941
softforks.push_back(SoftForkDesc("bip66", 3, tip, consensusParams));
933942
softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams));
934-
bip9_softforks.push_back(Pair("csv", BIP9SoftForkDesc(consensusParams, Consensus::DEPLOYMENT_CSV)));
935-
bip9_softforks.push_back(Pair("segwit", BIP9SoftForkDesc(consensusParams, Consensus::DEPLOYMENT_SEGWIT)));
943+
BIP9SoftForkDescPushBack(bip9_softforks, "csv", consensusParams, Consensus::DEPLOYMENT_CSV);
944+
BIP9SoftForkDescPushBack(bip9_softforks, "segwit", consensusParams, Consensus::DEPLOYMENT_SEGWIT);
936945
obj.push_back(Pair("softforks", softforks));
937946
obj.push_back(Pair("bip9_softforks", bip9_softforks));
938947

0 commit comments

Comments
 (0)