Index: Use prune locks for blockfilterindex

Prior to this change blocks could be pruned up to the last block before the blockfilterindex current best block.
This commit is contained in:
Fabian Jahr
2021-04-18 23:06:18 +02:00
parent 2561823531
commit f08c9fb0c6
7 changed files with 31 additions and 15 deletions

View File

@@ -19,7 +19,6 @@
#include <deploymentstatus.h>
#include <flatfile.h>
#include <hash.h>
#include <index/blockfilterindex.h>
#include <logging.h>
#include <logging/timer.h>
#include <node/blockstorage.h>
@@ -2349,10 +2348,6 @@ bool CChainState::FlushStateToDisk(
int last_prune{m_chain.Height()}; // last height we can prune
std::optional<std::string> limiting_lock; // prune lock that actually was the limiting factor, only used for logging
ForEachBlockFilterIndex([&](BlockFilterIndex& index) {
last_prune = std::max(1, std::min(last_prune, index.GetSummary().best_block_height));
});
for (const auto& prune_lock : m_blockman.m_prune_locks) {
if (prune_lock.second.height_first == std::numeric_limits<int>::max()) continue;
// Remove the buffer and one additional block here to get actual height that is outside of the buffer