@@ -1384,8 +1384,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1384
1384
1385
1385
// If the loaded chain has a wrong genesis, bail out immediately
1386
1386
// (we're likely using a testnet datadir, or the other way around).
1387
+ assert (std::addressof (g_chainman.m_blockman ) == std::addressof (chainman.m_blockman ));
1387
1388
if (!chainman.BlockIndex ().empty () &&
1388
- !g_chainman .m_blockman .LookupBlockIndex (chainparams.GetConsensus ().hashGenesisBlock )) {
1389
+ !chainman .m_blockman .LookupBlockIndex (chainparams.GetConsensus ().hashGenesisBlock )) {
1389
1390
return InitError (_ (" Incorrect or no genesis block found. Wrong datadir for network?" ));
1390
1391
}
1391
1392
@@ -1400,7 +1401,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1400
1401
// If we're not mid-reindex (based on disk + args), add a genesis block on disk
1401
1402
// (otherwise we use the one already on disk).
1402
1403
// This is called again in ThreadImport after the reindex completes.
1403
- if (!fReindex && !:: ChainstateActive ().LoadGenesisBlock (chainparams)) {
1404
+ if (!fReindex && !chainman. ActiveChainstate ().LoadGenesisBlock (chainparams)) {
1404
1405
strLoadError = _ (" Error initializing block database" );
1405
1406
break ;
1406
1407
}
@@ -1549,21 +1550,21 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1549
1550
// ********************************************************* Step 8: start indexers
1550
1551
if (args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX)) {
1551
1552
g_txindex = std::make_unique<TxIndex>(nTxIndexCache, false , fReindex );
1552
- if (!g_txindex->Start (:: ChainstateActive ())) {
1553
+ if (!g_txindex->Start (chainman. ActiveChainstate ())) {
1553
1554
return false ;
1554
1555
}
1555
1556
}
1556
1557
1557
1558
for (const auto & filter_type : g_enabled_filter_types) {
1558
1559
InitBlockFilterIndex (filter_type, filter_index_cache, false , fReindex );
1559
- if (!GetBlockFilterIndex (filter_type)->Start (:: ChainstateActive ())) {
1560
+ if (!GetBlockFilterIndex (filter_type)->Start (chainman. ActiveChainstate ())) {
1560
1561
return false ;
1561
1562
}
1562
1563
}
1563
1564
1564
1565
if (args.GetBoolArg (" -coinstatsindex" , DEFAULT_COINSTATSINDEX)) {
1565
1566
g_coin_stats_index = std::make_unique<CoinStatsIndex>(/* cache size */ 0 , false , fReindex );
1566
- if (!g_coin_stats_index->Start (:: ChainstateActive ())) {
1567
+ if (!g_coin_stats_index->Start (chainman. ActiveChainstate ())) {
1567
1568
return false ;
1568
1569
}
1569
1570
}
@@ -1611,7 +1612,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1611
1612
// Either install a handler to notify us when genesis activates, or set fHaveGenesis directly.
1612
1613
// No locking, as this happens before any background thread is started.
1613
1614
boost::signals2::connection block_notify_genesis_wait_connection;
1614
- if (::ChainActive ().Tip () == nullptr ) {
1615
+ assert (std::addressof (::ChainActive ()) == std::addressof (chainman.ActiveChain ()));
1616
+ if (chainman.ActiveChain ().Tip () == nullptr ) {
1615
1617
block_notify_genesis_wait_connection = uiInterface.NotifyBlockTip_connect (std::bind (BlockNotifyGenesisWait, std::placeholders::_2));
1616
1618
} else {
1617
1619
fHaveGenesis = true ;
0 commit comments