File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -942,6 +942,19 @@ static std::string ResolveErrMsg(const char * const optname, const std::string&
942942 return strprintf (_ (" Cannot resolve -%s address: '%s'" ), optname, strBind);
943943}
944944
945+ // Sets the last CACHED_BLOCK_HASHES hashes into masternode manager cache
946+ static void LoadBlockHashesCache (CMasternodeMan& man)
947+ {
948+ LOCK (cs_main);
949+ const CBlockIndex* pindex = chainActive.Tip ();
950+ unsigned int inserted = 0 ;
951+ while (pindex && inserted < CACHED_BLOCK_HASHES) {
952+ man.CacheBlockHash (pindex);
953+ pindex = pindex->pprev ;
954+ ++inserted;
955+ }
956+ }
957+
945958void InitLogging ()
946959{
947960 // g_logger->m_print_to_file = !IsArgNegated("-debuglogfile");
@@ -1740,6 +1753,7 @@ bool AppInit2()
17401753 uiInterface.InitMessage (_ (" Loading masternode cache..." ));
17411754
17421755 mnodeman.SetBestHeight (nChainHeight);
1756+ LoadBlockHashesCache (mnodeman);
17431757 CMasternodeDB mndb;
17441758 CMasternodeDB::ReadResult readResult = mndb.Read (mnodeman);
17451759 if (readResult == CMasternodeDB::FileError)
You can’t perform that action at this time.
0 commit comments