0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

scripted-diff: rename versionbitscache

-BEGIN VERIFY SCRIPT-
sed -i -e 's/versionbitscache/g_versionbitscache/g' $(git grep -l versionbitscache)
-END VERIFY SCRIPT-
This commit is contained in:
Anthony Towns 2021-06-11 06:59:53 +10:00
parent de55304f6e
commit c64b2c6a0f
6 changed files with 10 additions and 10 deletions

View file

@ -7,7 +7,7 @@
#include <consensus/params.h> #include <consensus/params.h>
#include <versionbits.h> #include <versionbits.h>
VersionBitsCache versionbitscache; VersionBitsCache g_versionbitscache;
/* Basic sanity checking for BuriedDeployment/DeploymentPos enums and /* Basic sanity checking for BuriedDeployment/DeploymentPos enums and
* ValidDeployment check */ * ValidDeployment check */

View file

@ -11,7 +11,7 @@
#include <limits> #include <limits>
/** Global cache for versionbits deployment status */ /** Global cache for versionbits deployment status */
extern VersionBitsCache versionbitscache; extern VersionBitsCache g_versionbitscache;
/** Determine if a deployment is active for the next block */ /** Determine if a deployment is active for the next block */
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep) inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep)
@ -23,7 +23,7 @@ inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep) inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep)
{ {
assert(Consensus::ValidDeployment(dep)); assert(Consensus::ValidDeployment(dep));
return ThresholdState::ACTIVE == VersionBitsState(pindexPrev, params, dep, versionbitscache); return ThresholdState::ACTIVE == VersionBitsState(pindexPrev, params, dep, g_versionbitscache);
} }
/** Determine if a deployment is active for this block */ /** Determine if a deployment is active for this block */

View file

@ -1369,7 +1369,7 @@ static void BIP9SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniVal
if (consensusParams.vDeployments[id].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) return; if (consensusParams.vDeployments[id].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) return;
UniValue bip9(UniValue::VOBJ); UniValue bip9(UniValue::VOBJ);
const ThresholdState thresholdState = VersionBitsState(active_chain_tip, consensusParams, id, versionbitscache); const ThresholdState thresholdState = VersionBitsState(active_chain_tip, consensusParams, id, g_versionbitscache);
switch (thresholdState) { switch (thresholdState) {
case ThresholdState::DEFINED: bip9.pushKV("status", "defined"); break; case ThresholdState::DEFINED: bip9.pushKV("status", "defined"); break;
case ThresholdState::STARTED: bip9.pushKV("status", "started"); break; case ThresholdState::STARTED: bip9.pushKV("status", "started"); break;
@ -1383,7 +1383,7 @@ static void BIP9SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniVal
} }
bip9.pushKV("start_time", consensusParams.vDeployments[id].nStartTime); bip9.pushKV("start_time", consensusParams.vDeployments[id].nStartTime);
bip9.pushKV("timeout", consensusParams.vDeployments[id].nTimeout); bip9.pushKV("timeout", consensusParams.vDeployments[id].nTimeout);
int64_t since_height = VersionBitsStateSinceHeight(active_chain_tip, consensusParams, id, versionbitscache); int64_t since_height = VersionBitsStateSinceHeight(active_chain_tip, consensusParams, id, g_versionbitscache);
bip9.pushKV("since", since_height); bip9.pushKV("since", since_height);
if (ThresholdState::STARTED == thresholdState) if (ThresholdState::STARTED == thresholdState)
{ {

View file

@ -841,7 +841,7 @@ static RPCHelpMan getblocktemplate()
UniValue vbavailable(UniValue::VOBJ); UniValue vbavailable(UniValue::VOBJ);
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) { for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
Consensus::DeploymentPos pos = Consensus::DeploymentPos(j); Consensus::DeploymentPos pos = Consensus::DeploymentPos(j);
ThresholdState state = VersionBitsState(pindexPrev, consensusParams, pos, versionbitscache); ThresholdState state = VersionBitsState(pindexPrev, consensusParams, pos, g_versionbitscache);
switch (state) { switch (state) {
case ThresholdState::DEFINED: case ThresholdState::DEFINED:
case ThresholdState::FAILED: case ThresholdState::FAILED:

View file

@ -259,8 +259,8 @@ BOOST_AUTO_TEST_CASE(versionbits_test)
/** Check that ComputeBlockVersion will set the appropriate bit correctly */ /** Check that ComputeBlockVersion will set the appropriate bit correctly */
static void check_computeblockversion(const Consensus::Params& params, Consensus::DeploymentPos dep) static void check_computeblockversion(const Consensus::Params& params, Consensus::DeploymentPos dep)
{ {
// This implicitly uses versionbitscache, so clear it every time // This implicitly uses g_versionbitscache, so clear it every time
versionbitscache.Clear(); g_versionbitscache.Clear();
int64_t bit = params.vDeployments[dep].bit; int64_t bit = params.vDeployments[dep].bit;
int64_t nStartTime = params.vDeployments[dep].nStartTime; int64_t nStartTime = params.vDeployments[dep].nStartTime;

View file

@ -1611,7 +1611,7 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
int32_t nVersion = VERSIONBITS_TOP_BITS; int32_t nVersion = VERSIONBITS_TOP_BITS;
for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) { for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) {
ThresholdState state = VersionBitsState(pindexPrev, params, static_cast<Consensus::DeploymentPos>(i), versionbitscache); ThresholdState state = VersionBitsState(pindexPrev, params, static_cast<Consensus::DeploymentPos>(i), g_versionbitscache);
if (state == ThresholdState::LOCKED_IN || state == ThresholdState::STARTED) { if (state == ThresholdState::LOCKED_IN || state == ThresholdState::STARTED) {
nVersion |= VersionBitsMask(params, static_cast<Consensus::DeploymentPos>(i)); nVersion |= VersionBitsMask(params, static_cast<Consensus::DeploymentPos>(i));
} }
@ -4110,7 +4110,7 @@ void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
nLastBlockFile = 0; nLastBlockFile = 0;
setDirtyBlockIndex.clear(); setDirtyBlockIndex.clear();
setDirtyFileInfo.clear(); setDirtyFileInfo.clear();
versionbitscache.Clear(); g_versionbitscache.Clear();
for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) { for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) {
warningcache[b].clear(); warningcache[b].clear();
} }