prune: scan and unlink already pruned block files on startup

This commit is contained in:
Andrew Toth
2022-12-20 12:25:36 -05:00
parent dcdfd72861
commit 77557dda4a
3 changed files with 32 additions and 3 deletions

View File

@@ -4260,6 +4260,8 @@ bool ChainstateManager::LoadBlockIndex()
bool ret = m_blockman.LoadBlockIndexDB(GetConsensus());
if (!ret) return false;
m_blockman.ScanAndUnlinkAlreadyPrunedFiles();
std::vector<CBlockIndex*> vSortedByHeight{m_blockman.GetAllBlockIndices()};
std::sort(vSortedByHeight.begin(), vSortedByHeight.end(),
CBlockIndexHeightOnlyComparator());