@@ -1430,7 +1430,7 @@ static RPCHelpMan verifychain()
14301430 };
14311431}
14321432
1433- static void SoftForkDescPushBack (const CBlockIndex* active_chain_tip , UniValue& softforks, const Consensus::Params& params, Consensus::BuriedDeployment dep)
1433+ static void SoftForkDescPushBack (const CBlockIndex* blockindex , UniValue& softforks, const Consensus::Params& params, Consensus::BuriedDeployment dep)
14341434{
14351435 // For buried deployments.
14361436
@@ -1440,17 +1440,17 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
14401440 rv.pushKV (" type" , " buried" );
14411441 // getdeploymentinfo reports the softfork as active from when the chain height is
14421442 // one below the activation height
1443- rv.pushKV (" active" , DeploymentActiveAfter (active_chain_tip , params, dep));
1443+ rv.pushKV (" active" , DeploymentActiveAfter (blockindex , params, dep));
14441444 rv.pushKV (" height" , params.DeploymentHeight (dep));
14451445 softforks.pushKV (DeploymentName (dep), rv);
14461446}
14471447
1448- static void SoftForkDescPushBack (const CBlockIndex* active_chain_tip , UniValue& softforks, const Consensus::Params& consensusParams, Consensus::DeploymentPos id)
1448+ static void SoftForkDescPushBack (const CBlockIndex* blockindex , UniValue& softforks, const Consensus::Params& consensusParams, Consensus::DeploymentPos id)
14491449{
14501450 // For BIP9 deployments.
14511451
14521452 if (!DeploymentEnabled (consensusParams, id)) return ;
1453- if (active_chain_tip == nullptr ) return ;
1453+ if (blockindex == nullptr ) return ;
14541454
14551455 auto get_state_name = [](const ThresholdState state) -> std::string {
14561456 switch (state) {
@@ -1465,8 +1465,8 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
14651465
14661466 UniValue bip9 (UniValue::VOBJ);
14671467
1468- const ThresholdState next_state = g_versionbitscache.State (active_chain_tip , consensusParams, id);
1469- const ThresholdState current_state = g_versionbitscache.State (active_chain_tip ->pprev , consensusParams, id);
1468+ const ThresholdState next_state = g_versionbitscache.State (blockindex , consensusParams, id);
1469+ const ThresholdState current_state = g_versionbitscache.State (blockindex ->pprev , consensusParams, id);
14701470
14711471 const bool has_signal = (ThresholdState::STARTED == current_state || ThresholdState::LOCKED_IN == current_state);
14721472
@@ -1480,14 +1480,14 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
14801480
14811481 // BIP9 status
14821482 bip9.pushKV (" status" , get_state_name (current_state));
1483- bip9.pushKV (" since" , g_versionbitscache.StateSinceHeight (active_chain_tip ->pprev , consensusParams, id));
1483+ bip9.pushKV (" since" , g_versionbitscache.StateSinceHeight (blockindex ->pprev , consensusParams, id));
14841484 bip9.pushKV (" status-next" , get_state_name (next_state));
14851485
14861486 // BIP9 signalling status, if applicable
14871487 if (has_signal) {
14881488 UniValue statsUV (UniValue::VOBJ);
14891489 std::vector<bool > signals;
1490- BIP9Stats statsStruct = g_versionbitscache.Statistics (active_chain_tip , consensusParams, id, &signals);
1490+ BIP9Stats statsStruct = g_versionbitscache.Statistics (blockindex , consensusParams, id, &signals);
14911491 statsUV.pushKV (" period" , statsStruct.period );
14921492 statsUV.pushKV (" elapsed" , statsStruct.elapsed );
14931493 statsUV.pushKV (" count" , statsStruct.count );
@@ -1508,7 +1508,7 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
15081508 UniValue rv (UniValue::VOBJ);
15091509 rv.pushKV (" type" , " bip9" );
15101510 if (ThresholdState::ACTIVE == next_state) {
1511- rv.pushKV (" height" , g_versionbitscache.StateSinceHeight (active_chain_tip , consensusParams, id));
1511+ rv.pushKV (" height" , g_versionbitscache.StateSinceHeight (blockindex , consensusParams, id));
15121512 }
15131513 rv.pushKV (" active" , ThresholdState::ACTIVE == next_state);
15141514 rv.pushKV (" bip9" , bip9);
@@ -1517,7 +1517,7 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
15171517}
15181518
15191519namespace {
1520- /* TODO: when -dprecatedrpc =softforks is removed, drop these */
1520+ /* TODO: when -deprecatedrpc =softforks is removed, drop these */
15211521UniValue DeploymentInfo (const CBlockIndex* tip, const Consensus::Params& consensusParams);
15221522extern const std::vector<RPCResult> RPCHelpForDeployment;
15231523}
@@ -1621,9 +1621,9 @@ const std::vector<RPCResult> RPCHelpForDeployment{
16211621 {RPCResult::Type::NUM_TIME, " start_time" , " the minimum median time past of a block at which the bit gains its meaning" },
16221622 {RPCResult::Type::NUM_TIME, " timeout" , " the median time past of a block at which the deployment is considered failed if not yet locked in" },
16231623 {RPCResult::Type::NUM, " min_activation_height" , " minimum height of blocks for which the rules may be enforced" },
1624- {RPCResult::Type::STR, " status" , " bip9 status of specified block (one of \" defined\" , \" started\" , \" locked_in\" , \" active\" , \" failed\" )" },
1624+ {RPCResult::Type::STR, " status" , " status of deployment at specified block (one of \" defined\" , \" started\" , \" locked_in\" , \" active\" , \" failed\" )" },
16251625 {RPCResult::Type::NUM, " since" , " height of the first block to which the status applies" },
1626- {RPCResult::Type::STR, " status-next" , " bip9 status of next block" },
1626+ {RPCResult::Type::STR, " status-next" , " status of deployment at the next block" },
16271627 {RPCResult::Type::OBJ, " statistics" , /* optional=*/ true , " numeric statistics about signalling for a softfork (only for \" started\" and \" locked_in\" status)" ,
16281628 {
16291629 {RPCResult::Type::NUM, " period" , " the length in blocks of the signalling period" },
@@ -1636,26 +1636,26 @@ const std::vector<RPCResult> RPCHelpForDeployment{
16361636 }},
16371637};
16381638
1639- UniValue DeploymentInfo (const CBlockIndex* tip , const Consensus::Params& consensusParams)
1639+ UniValue DeploymentInfo (const CBlockIndex* blockindex , const Consensus::Params& consensusParams)
16401640{
16411641 UniValue softforks (UniValue::VOBJ);
1642- SoftForkDescPushBack (tip , softforks, consensusParams, Consensus::DEPLOYMENT_HEIGHTINCB);
1643- SoftForkDescPushBack (tip , softforks, consensusParams, Consensus::DEPLOYMENT_DERSIG);
1644- SoftForkDescPushBack (tip , softforks, consensusParams, Consensus::DEPLOYMENT_CLTV);
1645- SoftForkDescPushBack (tip , softforks, consensusParams, Consensus::DEPLOYMENT_CSV);
1646- SoftForkDescPushBack (tip , softforks, consensusParams, Consensus::DEPLOYMENT_SEGWIT);
1647- SoftForkDescPushBack (tip , softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);
1648- SoftForkDescPushBack (tip , softforks, consensusParams, Consensus::DEPLOYMENT_TAPROOT);
1642+ SoftForkDescPushBack (blockindex , softforks, consensusParams, Consensus::DEPLOYMENT_HEIGHTINCB);
1643+ SoftForkDescPushBack (blockindex , softforks, consensusParams, Consensus::DEPLOYMENT_DERSIG);
1644+ SoftForkDescPushBack (blockindex , softforks, consensusParams, Consensus::DEPLOYMENT_CLTV);
1645+ SoftForkDescPushBack (blockindex , softforks, consensusParams, Consensus::DEPLOYMENT_CSV);
1646+ SoftForkDescPushBack (blockindex , softforks, consensusParams, Consensus::DEPLOYMENT_SEGWIT);
1647+ SoftForkDescPushBack (blockindex , softforks, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);
1648+ SoftForkDescPushBack (blockindex , softforks, consensusParams, Consensus::DEPLOYMENT_TAPROOT);
16491649 return softforks;
16501650}
16511651} // anon namespace
16521652
16531653static RPCHelpMan getdeploymentinfo ()
16541654{
16551655 return RPCHelpMan{" getdeploymentinfo" ,
1656- " Returns an object containing various state info regarding soft-forks ." ,
1656+ " Returns an object containing various state info regarding deployments of consensus changes ." ,
16571657 {
1658- {" blockhash" , RPCArg::Type::STR_HEX, RPCArg::Default{" chain tip" }, " The block hash at which to query fork state" },
1658+ {" blockhash" , RPCArg::Type::STR_HEX, RPCArg::Default{" hash of current chain tip" }, " The block hash at which to query deployment state" },
16591659 },
16601660 RPCResult{
16611661 RPCResult::Type::OBJ, " " , " " , {
@@ -1669,28 +1669,28 @@ static RPCHelpMan getdeploymentinfo()
16691669 RPCExamples{ HelpExampleCli (" getdeploymentinfo" , " " ) + HelpExampleRpc (" getdeploymentinfo" , " " ) },
16701670 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
16711671 {
1672- ChainstateManager& chainman = EnsureAnyChainman (request.context );
1672+ const ChainstateManager& chainman = EnsureAnyChainman (request.context );
16731673 LOCK (cs_main);
1674- CChainState& active_chainstate = chainman.ActiveChainstate ();
1674+ const CChainState& active_chainstate = chainman.ActiveChainstate ();
16751675
1676- const CBlockIndex* tip ;
1676+ const CBlockIndex* blockindex ;
16771677 if (request.params [0 ].isNull ()) {
1678- tip = active_chainstate.m_chain .Tip ();
1679- CHECK_NONFATAL (tip );
1678+ blockindex = active_chainstate.m_chain .Tip ();
1679+ CHECK_NONFATAL (blockindex );
16801680 } else {
1681- uint256 hash (ParseHashV (request.params [0 ], " blockhash" ));
1682- tip = chainman.m_blockman .LookupBlockIndex (hash);
1683- if (!tip ) {
1681+ const uint256 hash (ParseHashV (request.params [0 ], " blockhash" ));
1682+ blockindex = chainman.m_blockman .LookupBlockIndex (hash);
1683+ if (!blockindex ) {
16841684 throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Block not found" );
16851685 }
16861686 }
16871687
16881688 const Consensus::Params& consensusParams = Params ().GetConsensus ();
16891689
16901690 UniValue deploymentinfo (UniValue::VOBJ);
1691- deploymentinfo.pushKV (" hash" , tip ->GetBlockHash ().ToString ());
1692- deploymentinfo.pushKV (" height" , tip ->nHeight );
1693- deploymentinfo.pushKV (" deployments" , DeploymentInfo (tip , consensusParams));
1691+ deploymentinfo.pushKV (" hash" , blockindex ->GetBlockHash ().ToString ());
1692+ deploymentinfo.pushKV (" height" , blockindex ->nHeight );
1693+ deploymentinfo.pushKV (" deployments" , DeploymentInfo (blockindex , consensusParams));
16941694 return deploymentinfo;
16951695 },
16961696 };
0 commit comments