@@ -1064,26 +1064,26 @@ static RPCHelpMan verifychain()
10641064 };
10651065}
10661066
1067- static void SoftForkDescPushBack (const CBlockIndex* blockindex, UniValue& softforks, const Consensus::Params& params , Consensus::BuriedDeployment dep)
1067+ static void SoftForkDescPushBack (const CBlockIndex* blockindex, UniValue& softforks, const ChainstateManager& chainman , Consensus::BuriedDeployment dep)
10681068{
10691069 // For buried deployments.
10701070
1071- if (!DeploymentEnabled (params , dep)) return ;
1071+ if (!DeploymentEnabled (chainman , dep)) return ;
10721072
10731073 UniValue rv (UniValue::VOBJ);
10741074 rv.pushKV (" type" , " buried" );
10751075 // getdeploymentinfo reports the softfork as active from when the chain height is
10761076 // one below the activation height
1077- rv.pushKV (" active" , DeploymentActiveAfter (blockindex, params , dep));
1078- rv.pushKV (" height" , params .DeploymentHeight (dep));
1077+ rv.pushKV (" active" , DeploymentActiveAfter (blockindex, chainman , dep));
1078+ rv.pushKV (" height" , chainman. GetConsensus () .DeploymentHeight (dep));
10791079 softforks.pushKV (DeploymentName (dep), rv);
10801080}
10811081
1082- static void SoftForkDescPushBack (const CBlockIndex* blockindex, UniValue& softforks, const Consensus::Params& consensusParams , Consensus::DeploymentPos id)
1082+ static void SoftForkDescPushBack (const CBlockIndex* blockindex, UniValue& softforks, const ChainstateManager& chainman , Consensus::DeploymentPos id)
10831083{
10841084 // For BIP9 deployments.
10851085
1086- if (!DeploymentEnabled (consensusParams , id)) return ;
1086+ if (!DeploymentEnabled (chainman , id)) return ;
10871087 if (blockindex == nullptr ) return ;
10881088
10891089 auto get_state_name = [](const ThresholdState state) -> std::string {
@@ -1099,29 +1099,29 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo
10991099
11001100 UniValue bip9 (UniValue::VOBJ);
11011101
1102- const ThresholdState next_state = g_versionbitscache. State (blockindex, consensusParams , id);
1103- const ThresholdState current_state = g_versionbitscache. State (blockindex->pprev , consensusParams , id);
1102+ const ThresholdState next_state = chainman. m_versionbitscache . State (blockindex, chainman. GetConsensus () , id);
1103+ const ThresholdState current_state = chainman. m_versionbitscache . State (blockindex->pprev , chainman. GetConsensus () , id);
11041104
11051105 const bool has_signal = (ThresholdState::STARTED == current_state || ThresholdState::LOCKED_IN == current_state);
11061106
11071107 // BIP9 parameters
11081108 if (has_signal) {
1109- bip9.pushKV (" bit" , consensusParams .vDeployments [id].bit );
1109+ bip9.pushKV (" bit" , chainman. GetConsensus () .vDeployments [id].bit );
11101110 }
1111- bip9.pushKV (" start_time" , consensusParams .vDeployments [id].nStartTime );
1112- bip9.pushKV (" timeout" , consensusParams .vDeployments [id].nTimeout );
1113- bip9.pushKV (" min_activation_height" , consensusParams .vDeployments [id].min_activation_height );
1111+ bip9.pushKV (" start_time" , chainman. GetConsensus () .vDeployments [id].nStartTime );
1112+ bip9.pushKV (" timeout" , chainman. GetConsensus () .vDeployments [id].nTimeout );
1113+ bip9.pushKV (" min_activation_height" , chainman. GetConsensus () .vDeployments [id].min_activation_height );
11141114
11151115 // BIP9 status
11161116 bip9.pushKV (" status" , get_state_name (current_state));
1117- bip9.pushKV (" since" , g_versionbitscache. StateSinceHeight (blockindex->pprev , consensusParams , id));
1117+ bip9.pushKV (" since" , chainman. m_versionbitscache . StateSinceHeight (blockindex->pprev , chainman. GetConsensus () , id));
11181118 bip9.pushKV (" status_next" , get_state_name (next_state));
11191119
11201120 // BIP9 signalling status, if applicable
11211121 if (has_signal) {
11221122 UniValue statsUV (UniValue::VOBJ);
11231123 std::vector<bool > signals;
1124- BIP9Stats statsStruct = g_versionbitscache. Statistics (blockindex, consensusParams , id, &signals);
1124+ BIP9Stats statsStruct = chainman. m_versionbitscache . Statistics (blockindex, chainman. GetConsensus () , id, &signals);
11251125 statsUV.pushKV (" period" , statsStruct.period );
11261126 statsUV.pushKV (" elapsed" , statsStruct.elapsed );
11271127 statsUV.pushKV (" count" , statsStruct.count );
@@ -1142,7 +1142,7 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo
11421142 UniValue rv (UniValue::VOBJ);
11431143 rv.pushKV (" type" , " bip9" );
11441144 if (ThresholdState::ACTIVE == next_state) {
1145- rv.pushKV (" height" , g_versionbitscache. StateSinceHeight (blockindex, consensusParams , id));
1145+ rv.pushKV (" height" , chainman. m_versionbitscache . StateSinceHeight (blockindex, chainman. GetConsensus () , id));
11461146 }
11471147 rv.pushKV (" active" , ThresholdState::ACTIVE == next_state);
11481148 rv.pushKV (" bip9" , bip9);
@@ -1152,7 +1152,7 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo
11521152
11531153namespace {
11541154/* TODO: when -deprecatedrpc=softforks is removed, drop these */
1155- UniValue DeploymentInfo (const CBlockIndex* tip, const Consensus::Params& consensusParams );
1155+ UniValue DeploymentInfo (const CBlockIndex* tip, const ChainstateManager& chainman );
11561156extern const std::vector<RPCResult> RPCHelpForDeployment;
11571157}
11581158
@@ -1227,8 +1227,7 @@ RPCHelpMan getblockchaininfo()
12271227 }
12281228
12291229 if (IsDeprecatedRPCEnabled (" softforks" )) {
1230- const Consensus::Params& consensusParams = Params ().GetConsensus ();
1231- obj.pushKV (" softforks" , DeploymentInfo (&tip, consensusParams));
1230+ obj.pushKV (" softforks" , DeploymentInfo (&tip, chainman));
12321231 }
12331232
12341233 obj.pushKV (" warnings" , GetWarnings (false ).original );
@@ -1263,16 +1262,16 @@ const std::vector<RPCResult> RPCHelpForDeployment{
12631262 }},
12641263};
12651264
1266- UniValue DeploymentInfo (const CBlockIndex* blockindex, const Consensus::Params& consensusParams )
1265+ UniValue DeploymentInfo (const CBlockIndex* blockindex, const ChainstateManager& chainman )
12671266{
12681267 UniValue softforks (UniValue::VOBJ);
1269- SoftForkDescPushBack (blockindex, softforks, consensusParams , Consensus::DEPLOYMENT_HEIGHTINCB);
1270- SoftForkDescPushBack (blockindex, softforks, consensusParams , Consensus::DEPLOYMENT_DERSIG);
1271- SoftForkDescPushBack (blockindex, softforks, consensusParams , Consensus::DEPLOYMENT_CLTV);
1272- SoftForkDescPushBack (blockindex, softforks, consensusParams , Consensus::DEPLOYMENT_CSV);
1273- SoftForkDescPushBack (blockindex, softforks, consensusParams , Consensus::DEPLOYMENT_SEGWIT);
1274- SoftForkDescPushBack (blockindex, softforks, consensusParams , Consensus::DEPLOYMENT_TESTDUMMY);
1275- SoftForkDescPushBack (blockindex, softforks, consensusParams , Consensus::DEPLOYMENT_TAPROOT);
1268+ SoftForkDescPushBack (blockindex, softforks, chainman , Consensus::DEPLOYMENT_HEIGHTINCB);
1269+ SoftForkDescPushBack (blockindex, softforks, chainman , Consensus::DEPLOYMENT_DERSIG);
1270+ SoftForkDescPushBack (blockindex, softforks, chainman , Consensus::DEPLOYMENT_CLTV);
1271+ SoftForkDescPushBack (blockindex, softforks, chainman , Consensus::DEPLOYMENT_CSV);
1272+ SoftForkDescPushBack (blockindex, softforks, chainman , Consensus::DEPLOYMENT_SEGWIT);
1273+ SoftForkDescPushBack (blockindex, softforks, chainman , Consensus::DEPLOYMENT_TESTDUMMY);
1274+ SoftForkDescPushBack (blockindex, softforks, chainman , Consensus::DEPLOYMENT_TAPROOT);
12761275 return softforks;
12771276}
12781277} // anon namespace
@@ -1311,12 +1310,10 @@ static RPCHelpMan getdeploymentinfo()
13111310 }
13121311 }
13131312
1314- const Consensus::Params& consensusParams = Params ().GetConsensus ();
1315-
13161313 UniValue deploymentinfo (UniValue::VOBJ);
13171314 deploymentinfo.pushKV (" hash" , blockindex->GetBlockHash ().ToString ());
13181315 deploymentinfo.pushKV (" height" , blockindex->nHeight );
1319- deploymentinfo.pushKV (" deployments" , DeploymentInfo (blockindex, consensusParams ));
1316+ deploymentinfo.pushKV (" deployments" , DeploymentInfo (blockindex, chainman ));
13201317 return deploymentinfo;
13211318 },
13221319 };
0 commit comments