validation: Remove global ::VersionBitsTip{State,SinceHeight,Statistics}
Tip: versionbitscache is currently a global so we didn't need to pass it
in to any of ::VersionBitsTip*'s callers
This commit is contained in:
1 parent
63e4c7316a
commit
31eac50c72
4 files changed
+6
-30
No files matched your search
@@ -1232,7 +1232,7 @@ static void BIP9SoftForkDescPushBack(UniValue& softforks, const std::string &nam
|
|||||||
if (consensusParams.vDeployments[id].nTimeout <= 1230768000) return;
|
if (consensusParams.vDeployments[id].nTimeout <= 1230768000) return;
|
||||||
|
|
||||||
UniValue bip9(UniValue::VOBJ);
|
UniValue bip9(UniValue::VOBJ);
|
||||||
const ThresholdState thresholdState = VersionBitsTipState(consensusParams, id);
|
const ThresholdState thresholdState = VersionBitsState(::ChainActive().Tip(), consensusParams, id, 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;
|
||||||
@@ -1246,12 +1246,12 @@ static void BIP9SoftForkDescPushBack(UniValue& softforks, const std::string &nam
|
|||||||
}
|
}
|
||||||
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 = VersionBitsTipStateSinceHeight(consensusParams, id);
|
int64_t since_height = VersionBitsStateSinceHeight(::ChainActive().Tip(), consensusParams, id, versionbitscache);
|
||||||
bip9.pushKV("since", since_height);
|
bip9.pushKV("since", since_height);
|
||||||
if (ThresholdState::STARTED == thresholdState)
|
if (ThresholdState::STARTED == thresholdState)
|
||||||
{
|
{
|
||||||
UniValue statsUV(UniValue::VOBJ);
|
UniValue statsUV(UniValue::VOBJ);
|
||||||
BIP9Stats statsStruct = VersionBitsTipStatistics(consensusParams, id);
|
BIP9Stats statsStruct = VersionBitsStatistics(::ChainActive().Tip(), consensusParams, id);
|
||||||
statsUV.pushKV("period", statsStruct.period);
|
statsUV.pushKV("period", statsStruct.period);
|
||||||
statsUV.pushKV("threshold", statsStruct.threshold);
|
statsUV.pushKV("threshold", statsStruct.threshold);
|
||||||
statsUV.pushKV("elapsed", statsStruct.elapsed);
|
statsUV.pushKV("elapsed", statsStruct.elapsed);
|
||||||
|
|||||||
@@ -4997,24 +4997,6 @@ CBlockFileInfo* GetBlockFileInfo(size_t n)
|
|||||||
return &vinfoBlockFile.at(n);
|
return &vinfoBlockFile.at(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThresholdState VersionBitsTipState(const Consensus::Params& params, Consensus::DeploymentPos pos)
|
|
||||||
{
|
|
||||||
LOCK(cs_main);
|
|
||||||
return VersionBitsState(::ChainActive().Tip(), params, pos, versionbitscache);
|
|
||||||
}
|
|
||||||
|
|
||||||
BIP9Stats VersionBitsTipStatistics(const Consensus::Params& params, Consensus::DeploymentPos pos)
|
|
||||||
{
|
|
||||||
LOCK(cs_main);
|
|
||||||
return VersionBitsStatistics(::ChainActive().Tip(), params, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::DeploymentPos pos)
|
|
||||||
{
|
|
||||||
LOCK(cs_main);
|
|
||||||
return VersionBitsStateSinceHeight(::ChainActive().Tip(), params, pos, versionbitscache);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const uint64_t MEMPOOL_DUMP_VERSION = 1;
|
static const uint64_t MEMPOOL_DUMP_VERSION = 1;
|
||||||
|
|
||||||
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate)
|
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate)
|
||||||
|
|||||||
@@ -226,15 +226,6 @@ struct MempoolAcceptResult {
|
|||||||
MempoolAcceptResult AcceptToMemoryPool(CChainState& active_chainstate, CTxMemPool& pool, const CTransactionRef& tx,
|
MempoolAcceptResult AcceptToMemoryPool(CChainState& active_chainstate, CTxMemPool& pool, const CTransactionRef& tx,
|
||||||
bool bypass_limits, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
bool bypass_limits, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
|
|
||||||
/** Get the BIP9 state for a given deployment at the current tip. */
|
|
||||||
ThresholdState VersionBitsTipState(const Consensus::Params& params, Consensus::DeploymentPos pos);
|
|
||||||
|
|
||||||
/** Get the numerical statistics for the BIP9 state for a given deployment at the current tip. */
|
|
||||||
BIP9Stats VersionBitsTipStatistics(const Consensus::Params& params, Consensus::DeploymentPos pos);
|
|
||||||
|
|
||||||
/** Get the block height at which the BIP9 deployment switched into the state for the block building on the current tip. */
|
|
||||||
int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::DeploymentPos pos);
|
|
||||||
|
|
||||||
|
|
||||||
/** Apply the effects of this transaction on the UTXO set represented by view */
|
/** Apply the effects of this transaction on the UTXO set represented by view */
|
||||||
void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight);
|
void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight);
|
||||||
|
|||||||
@@ -79,8 +79,11 @@ struct VersionBitsCache
|
|||||||
void Clear();
|
void Clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Get the BIP9 state for a given deployment at the current tip. */
|
||||||
ThresholdState VersionBitsState(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache);
|
ThresholdState VersionBitsState(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache);
|
||||||
|
/** Get the numerical statistics for the BIP9 state for a given deployment at the current tip. */
|
||||||
BIP9Stats VersionBitsStatistics(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos);
|
BIP9Stats VersionBitsStatistics(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos);
|
||||||
|
/** Get the block height at which the BIP9 deployment switched into the state for the block building on the current tip. */
|
||||||
int VersionBitsStateSinceHeight(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache);
|
int VersionBitsStateSinceHeight(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache);
|
||||||
uint32_t VersionBitsMask(const Consensus::Params& params, Consensus::DeploymentPos pos);
|
uint32_t VersionBitsMask(const Consensus::Params& params, Consensus::DeploymentPos pos);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user