Page MenuHomePhabricator

D11739.id34360.diff
No OneTemporary

D11739.id34360.diff

diff --git a/src/avalanche/test/processor_tests.cpp b/src/avalanche/test/processor_tests.cpp
--- a/src/avalanche/test/processor_tests.cpp
+++ b/src/avalanche/test/processor_tests.cpp
@@ -225,7 +225,8 @@
const BlockHash blockHash = block.GetHash();
LOCK(cs_main);
- return g_chainman.m_blockman.LookupBlockIndex(blockHash);
+ return Assert(fixture->m_node.chainman)
+ ->m_blockman.LookupBlockIndex(blockHash);
}
uint256 getVoteItemId(const CBlockIndex *pindex) const {
@@ -902,7 +903,8 @@
const CBlockIndex *pindex;
{
LOCK(cs_main);
- pindex = g_chainman.m_blockman.LookupBlockIndex(blockHash);
+ pindex =
+ Assert(m_node.chainman)->m_blockman.LookupBlockIndex(blockHash);
}
// Create nodes that supports avalanche.
@@ -965,7 +967,8 @@
const CBlockIndex *pindex;
{
LOCK(cs_main);
- pindex = g_chainman.m_blockman.LookupBlockIndex(blockHash);
+ pindex =
+ Assert(m_node.chainman)->m_blockman.LookupBlockIndex(blockHash);
}
// Starting the event loop.
@@ -1148,7 +1151,8 @@
CScript script = GetScriptForDestination(PKHash(key.GetPubKey()));
LOCK(cs_main);
- CCoinsViewCache &coins = ::ChainstateActive().CoinsTip();
+ CCoinsViewCache &coins =
+ Assert(m_node.chainman)->ActiveChainstate().CoinsTip();
coins.AddCoin(conflictingOutpoint,
Coin(CTxOut(10 * COIN, script), 10, false), false);
coins.AddCoin(immatureOutpoint,
@@ -1232,9 +1236,10 @@
gArgs.ForceSetArg("-avaproof", localProof->ToHex());
bilingual_str error;
+ ChainstateManager &chainman = *Assert(m_node.chainman);
std::unique_ptr<Processor> processor = Processor::MakeProcessor(
- *m_node.args, *m_node.chain, m_node.connman.get(),
- *Assert(m_node.chainman), *m_node.scheduler, error);
+ *m_node.args, *m_node.chain, m_node.connman.get(), chainman,
+ *m_node.scheduler, error);
BOOST_CHECK(processor != nullptr);
BOOST_CHECK(processor->getLocalProof() != nullptr);
@@ -1299,10 +1304,10 @@
BOOST_CHECK(processor->isQuorumEstablished());
// Remove peers one at a time and ensure the quorum stays established
- auto spendProofUtxo = [&processor](ProofRef proof) {
+ auto spendProofUtxo = [&processor, &chainman](ProofRef proof) {
{
LOCK(cs_main);
- CCoinsViewCache &coins = ::ChainstateActive().CoinsTip();
+ CCoinsViewCache &coins = chainman.ActiveChainstate().CoinsTip();
coins.SpendCoin(proof->getStakes()[0].getStake().getUTXO());
}
processor->withPeerManager([&proof](avalanche::PeerManager &pm) {
diff --git a/src/avalanche/test/proof_tests.cpp b/src/avalanche/test/proof_tests.cpp
--- a/src/avalanche/test/proof_tests.cpp
+++ b/src/avalanche/test/proof_tests.cpp
@@ -898,6 +898,8 @@
const Amount value = 12345 * COIN;
const uint32_t height = 10;
+ ChainstateManager &chainman = *Assert(m_node.chainman);
+
COutPoint pkh_outpoint(TxId(InsecureRand256()), InsecureRand32());
CTxOut pkh_output(value, GetScriptForRawPubKey(pubkey));
coins.AddCoin(pkh_outpoint, Coin(pkh_output, height, false), false);
@@ -1029,7 +1031,7 @@
// Immature stake
{
- uint32_t chaintipHeight = ::ChainActive().Height();
+ uint32_t chaintipHeight = chainman.ActiveHeight();
// A proof where the UTXO is both missing and immature gives
// MISSING_UTXO
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -201,11 +201,11 @@
LOCK(cs_main);
CBlockIndex *pblockindex =
- g_chainman.m_blockman.LookupBlockIndex(hash);
+ chainman.m_blockman.LookupBlockIndex(hash);
if (pblockindex && !pblockindex->nStatus.isValid()) {
LogPrintf("Reconsidering checkpointed block %s ...\n",
hash.GetHex());
- ::ChainstateActive().ResetBlockFailureFlags(pblockindex);
+ chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex);
}
}
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -352,8 +352,7 @@
gArgs.GetArg("-limitdescendantcount", DEFAULT_DESCENDANT_LIMIT)),
m_limit_descendant_size(gArgs.GetArg("-limitdescendantsize",
DEFAULT_DESCENDANT_SIZE_LIMIT) *
- 1000) {
- }
+ 1000) {}
// We put the arguments we're handed into a struct, so we can pass them
// around easier.
@@ -718,7 +717,7 @@
Workspace workspace(ptx, GetNextBlockScriptFlags(
args.m_config.GetChainParams().GetConsensus(),
- ::ChainActive().Tip()));
+ m_active_chainstate.m_chain.Tip()));
if (!PreChecks(args, workspace)) {
return false;
@@ -4825,7 +4824,6 @@
int nCheckDepth) {
AssertLockHeld(cs_main);
-
const CChainParams &params = config.GetChainParams();
const Consensus::Params &consensusParams = params.GetConsensus();

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 28, 19:34 (8 h, 38 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4844961
Default Alt Text
D11739.id34360.diff (5 KB)

Event Timeline