aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2021-06-11 06:59:53 +1000
committerAnthony Towns <aj@erisian.com.au>2021-06-30 08:19:12 +1000
commitc64b2c6a0f79369624ae96b2e3d579d50aae4de6 (patch)
tree666e3fbbdf9ee9b06e40ac0955b90bf0fe6b4800
parentde55304f6e7a8b607e6b3fc7436de50910747b0c (diff)
downloadbitcoin-c64b2c6a0f79369624ae96b2e3d579d50aae4de6.tar.xz
scripted-diff: rename versionbitscache
-BEGIN VERIFY SCRIPT- sed -i -e 's/versionbitscache/g_versionbitscache/g' $(git grep -l versionbitscache) -END VERIFY SCRIPT-
-rw-r--r--src/deploymentstatus.cpp2
-rw-r--r--src/deploymentstatus.h4
-rw-r--r--src/rpc/blockchain.cpp4
-rw-r--r--src/rpc/mining.cpp2
-rw-r--r--src/test/versionbits_tests.cpp4
-rw-r--r--src/validation.cpp4
6 files changed, 10 insertions, 10 deletions
diff --git a/src/deploymentstatus.cpp b/src/deploymentstatus.cpp
index 4e13fd7e0a..9007800421 100644
--- a/src/deploymentstatus.cpp
+++ b/src/deploymentstatus.cpp
@@ -7,7 +7,7 @@
#include <consensus/params.h>
#include <versionbits.h>
-VersionBitsCache versionbitscache;
+VersionBitsCache g_versionbitscache;
/* Basic sanity checking for BuriedDeployment/DeploymentPos enums and
* ValidDeployment check */
diff --git a/src/deploymentstatus.h b/src/deploymentstatus.h
index 327a5f7892..3c4f1895a1 100644
--- a/src/deploymentstatus.h
+++ b/src/deploymentstatus.h
@@ -11,7 +11,7 @@
#include <limits>
/** Global cache for versionbits deployment status */
-extern VersionBitsCache versionbitscache;
+extern VersionBitsCache g_versionbitscache;
/** Determine if a deployment is active for the next block */
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)
{
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 */
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 7ba6e13142..7ceff17d0b 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1369,7 +1369,7 @@ static void BIP9SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniVal
if (consensusParams.vDeployments[id].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) return;
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) {
case ThresholdState::DEFINED: bip9.pushKV("status", "defined"); 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("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);
if (ThresholdState::STARTED == thresholdState)
{
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index f054c8b145..d6ca0959f2 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -841,7 +841,7 @@ static RPCHelpMan getblocktemplate()
UniValue vbavailable(UniValue::VOBJ);
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
Consensus::DeploymentPos pos = Consensus::DeploymentPos(j);
- ThresholdState state = VersionBitsState(pindexPrev, consensusParams, pos, versionbitscache);
+ ThresholdState state = VersionBitsState(pindexPrev, consensusParams, pos, g_versionbitscache);
switch (state) {
case ThresholdState::DEFINED:
case ThresholdState::FAILED:
diff --git a/src/test/versionbits_tests.cpp b/src/test/versionbits_tests.cpp
index a89447732e..49c61f5f2f 100644
--- a/src/test/versionbits_tests.cpp
+++ b/src/test/versionbits_tests.cpp
@@ -259,8 +259,8 @@ BOOST_AUTO_TEST_CASE(versionbits_test)
/** Check that ComputeBlockVersion will set the appropriate bit correctly */
static void check_computeblockversion(const Consensus::Params& params, Consensus::DeploymentPos dep)
{
- // This implicitly uses versionbitscache, so clear it every time
- versionbitscache.Clear();
+ // This implicitly uses g_versionbitscache, so clear it every time
+ g_versionbitscache.Clear();
int64_t bit = params.vDeployments[dep].bit;
int64_t nStartTime = params.vDeployments[dep].nStartTime;
diff --git a/src/validation.cpp b/src/validation.cpp
index 782a6cd56d..d2baa92dde 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1611,7 +1611,7 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
int32_t nVersion = VERSIONBITS_TOP_BITS;
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) {
nVersion |= VersionBitsMask(params, static_cast<Consensus::DeploymentPos>(i));
}
@@ -4110,7 +4110,7 @@ void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
nLastBlockFile = 0;
setDirtyBlockIndex.clear();
setDirtyFileInfo.clear();
- versionbitscache.Clear();
+ g_versionbitscache.Clear();
for (int b = 0; b < VERSIONBITS_NUM_BITS; b++) {
warningcache[b].clear();
}