File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -506,9 +506,16 @@ CDeterministicMNList CDeterministicMNManager::GetListForBlock(const uint256& blo
506506
507507 uint256 blockHashTmp = blockHash;
508508 CDeterministicMNList snapshot;
509- std::vector <CDeterministicMNListDiff> vecDiff ;
509+ std::list <CDeterministicMNListDiff> listDiff ;
510510
511511 while (true ) {
512+ // try using cache before reading from disk
513+ it = mnListsCache.find (blockHashTmp);
514+ if (it != mnListsCache.end ()) {
515+ snapshot = it->second ;
516+ break ;
517+ }
518+
512519 if (evoDb.Read (std::make_pair (DB_LIST_SNAPSHOT, blockHashTmp), snapshot)) {
513520 break ;
514521 }
@@ -519,11 +526,11 @@ CDeterministicMNList CDeterministicMNManager::GetListForBlock(const uint256& blo
519526 break ;
520527 }
521528
522- vecDiff. emplace (vecDiff. begin (), diff);
529+ listDiff. emplace_front ( diff);
523530 blockHashTmp = diff.prevBlockHash ;
524531 }
525532
526- for (const auto & diff : vecDiff ) {
533+ for (const auto & diff : listDiff ) {
527534 if (diff.HasChanges ()) {
528535 snapshot = snapshot.ApplyDiff (diff);
529536 } else {
You can’t perform that action at this time.
0 commit comments