@@ -1064,26 +1064,26 @@ static RPCHelpMan verifychain()
1064
1064
};
1065
1065
}
1066
1066
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)
1068
1068
{
1069
1069
// For buried deployments.
1070
1070
1071
- if (!DeploymentEnabled (params , dep)) return ;
1071
+ if (!DeploymentEnabled (chainman , dep)) return ;
1072
1072
1073
1073
UniValue rv (UniValue::VOBJ);
1074
1074
rv.pushKV (" type" , " buried" );
1075
1075
// getdeploymentinfo reports the softfork as active from when the chain height is
1076
1076
// 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));
1079
1079
softforks.pushKV (DeploymentName (dep), rv);
1080
1080
}
1081
1081
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)
1083
1083
{
1084
1084
// For BIP9 deployments.
1085
1085
1086
- if (!DeploymentEnabled (consensusParams , id)) return ;
1086
+ if (!DeploymentEnabled (chainman , id)) return ;
1087
1087
if (blockindex == nullptr ) return ;
1088
1088
1089
1089
auto get_state_name = [](const ThresholdState state) -> std::string {
@@ -1099,29 +1099,29 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo
1099
1099
1100
1100
UniValue bip9 (UniValue::VOBJ);
1101
1101
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);
1104
1104
1105
1105
const bool has_signal = (ThresholdState::STARTED == current_state || ThresholdState::LOCKED_IN == current_state);
1106
1106
1107
1107
// BIP9 parameters
1108
1108
if (has_signal) {
1109
- bip9.pushKV (" bit" , consensusParams .vDeployments [id].bit );
1109
+ bip9.pushKV (" bit" , chainman. GetConsensus () .vDeployments [id].bit );
1110
1110
}
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 );
1114
1114
1115
1115
// BIP9 status
1116
1116
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));
1118
1118
bip9.pushKV (" status_next" , get_state_name (next_state));
1119
1119
1120
1120
// BIP9 signalling status, if applicable
1121
1121
if (has_signal) {
1122
1122
UniValue statsUV (UniValue::VOBJ);
1123
1123
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);
1125
1125
statsUV.pushKV (" period" , statsStruct.period );
1126
1126
statsUV.pushKV (" elapsed" , statsStruct.elapsed );
1127
1127
statsUV.pushKV (" count" , statsStruct.count );
@@ -1142,7 +1142,7 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo
1142
1142
UniValue rv (UniValue::VOBJ);
1143
1143
rv.pushKV (" type" , " bip9" );
1144
1144
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));
1146
1146
}
1147
1147
rv.pushKV (" active" , ThresholdState::ACTIVE == next_state);
1148
1148
rv.pushKV (" bip9" , bip9);
@@ -1152,7 +1152,7 @@ static void SoftForkDescPushBack(const CBlockIndex* blockindex, UniValue& softfo
1152
1152
1153
1153
namespace {
1154
1154
/* 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 );
1156
1156
extern const std::vector<RPCResult> RPCHelpForDeployment;
1157
1157
}
1158
1158
@@ -1227,8 +1227,7 @@ RPCHelpMan getblockchaininfo()
1227
1227
}
1228
1228
1229
1229
if (IsDeprecatedRPCEnabled (" softforks" )) {
1230
- const Consensus::Params& consensusParams = Params ().GetConsensus ();
1231
- obj.pushKV (" softforks" , DeploymentInfo (&tip, consensusParams));
1230
+ obj.pushKV (" softforks" , DeploymentInfo (&tip, chainman));
1232
1231
}
1233
1232
1234
1233
obj.pushKV (" warnings" , GetWarnings (false ).original );
@@ -1263,16 +1262,16 @@ const std::vector<RPCResult> RPCHelpForDeployment{
1263
1262
}},
1264
1263
};
1265
1264
1266
- UniValue DeploymentInfo (const CBlockIndex* blockindex, const Consensus::Params& consensusParams )
1265
+ UniValue DeploymentInfo (const CBlockIndex* blockindex, const ChainstateManager& chainman )
1267
1266
{
1268
1267
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);
1276
1275
return softforks;
1277
1276
}
1278
1277
} // anon namespace
@@ -1311,12 +1310,10 @@ static RPCHelpMan getdeploymentinfo()
1311
1310
}
1312
1311
}
1313
1312
1314
- const Consensus::Params& consensusParams = Params ().GetConsensus ();
1315
-
1316
1313
UniValue deploymentinfo (UniValue::VOBJ);
1317
1314
deploymentinfo.pushKV (" hash" , blockindex->GetBlockHash ().ToString ());
1318
1315
deploymentinfo.pushKV (" height" , blockindex->nHeight );
1319
- deploymentinfo.pushKV (" deployments" , DeploymentInfo (blockindex, consensusParams ));
1316
+ deploymentinfo.pushKV (" deployments" , DeploymentInfo (blockindex, chainman ));
1320
1317
return deploymentinfo;
1321
1318
},
1322
1319
};
0 commit comments