mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
blockstorage: Add prune locks to BlockManager
This change also introduces an aditional buffer of 10 blocks (PRUNE_LOCK_BUFFER) that will not be pruned before the best block. Co-authored-by: Luke Dashjr <luke-jr+git@utopios.org>
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include <util/system.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace node {
|
||||
std::atomic_bool fImporting(false);
|
||||
std::atomic_bool fReindex(false);
|
||||
@@ -230,6 +232,11 @@ void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPr
|
||||
nLastBlockWeCanPrune, count);
|
||||
}
|
||||
|
||||
void BlockManager::UpdatePruneLock(const std::string& name, const PruneLockInfo& lock_info) {
|
||||
AssertLockHeld(::cs_main);
|
||||
m_prune_locks[name] = lock_info;
|
||||
}
|
||||
|
||||
CBlockIndex* BlockManager::InsertBlockIndex(const uint256& hash)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
|
||||
Reference in New Issue
Block a user