Skip to content

Commit e5f0356

Browse files
committed
rpc/blockchain: rename getdeploymentinfo tip/active_chain_tip to blockindex
1 parent fbab43f commit e5f0356

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/rpc/blockchain.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
@@ -1636,16 +1636,16 @@ 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
@@ -1673,24 +1673,24 @@ static RPCHelpMan getdeploymentinfo()
16731673
LOCK(cs_main);
16741674
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 {
16811681
const uint256 hash(ParseHashV(request.params[0], "blockhash"));
1682-
tip = chainman.m_blockman.LookupBlockIndex(hash);
1683-
if (!tip) {
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

Comments
 (0)