@@ -1631,9 +1631,16 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1631
1631
1632
1632
// ********************************************************* Step 11: start node
1633
1633
1634
+ int chain_active_height;
1635
+
1634
1636
// // debug print
1635
- LogPrintf (" mapBlockIndex.size() = %u\n " , mapBlockIndex.size ());
1636
- LogPrintf (" nBestHeight = %d\n " , chainActive.Height ());
1637
+ {
1638
+ LOCK (cs_main);
1639
+ LogPrintf (" mapBlockIndex.size() = %u\n " , mapBlockIndex.size ());
1640
+ chain_active_height = chainActive.Height ();
1641
+ }
1642
+ LogPrintf (" nBestHeight = %d\n " , chain_active_height);
1643
+
1637
1644
if (gArgs .GetBoolArg (" -listenonion" , DEFAULT_LISTEN_ONION))
1638
1645
StartTorControl (threadGroup, scheduler);
1639
1646
@@ -1649,7 +1656,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1649
1656
connOptions.nMaxOutbound = std::min (MAX_OUTBOUND_CONNECTIONS, connOptions.nMaxConnections );
1650
1657
connOptions.nMaxAddnode = MAX_ADDNODE_CONNECTIONS;
1651
1658
connOptions.nMaxFeeler = 1 ;
1652
- connOptions.nBestHeight = chainActive. Height () ;
1659
+ connOptions.nBestHeight = chain_active_height ;
1653
1660
connOptions.uiInterface = &uiInterface;
1654
1661
connOptions.nSendBufferMaxSize = 1000 *gArgs .GetArg (" -maxsendbuffer" , DEFAULT_MAXSENDBUFFER);
1655
1662
connOptions.nReceiveFloodSize = 1000 *gArgs .GetArg (" -maxreceivebuffer" , DEFAULT_MAXRECEIVEBUFFER);
0 commit comments