diff options
author | Fabian Jahr <fjahr@protonmail.com> | 2021-05-13 19:13:08 +0200 |
---|---|---|
committer | Fabian Jahr <fjahr@protonmail.com> | 2022-04-25 23:21:58 +0200 |
commit | 2561823531c25e1510c107eb41de944b00444ce0 (patch) | |
tree | 715633d4adf89c6c78b9733ed1f2d6cd776843bf /src/node/blockstorage.cpp | |
parent | 231fc7b035481f748159968353c1cab81354e843 (diff) | |
download | bitcoin-2561823531c25e1510c107eb41de944b00444ce0.tar.xz |
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>
Diffstat (limited to 'src/node/blockstorage.cpp')
-rw-r--r-- | src/node/blockstorage.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index c3f42fde2d..8ed22bbbce 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -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); |