blockstorage: Add DeletePruneLock

Also adds basic unit test coverage for prune lock management methods.
This commit is contained in:
Fabian Jahr
2026-03-21 23:42:17 +01:00
parent 8cc690ea9b
commit fe58eb9850
3 changed files with 31 additions and 0 deletions

View File

@@ -404,6 +404,12 @@ void BlockManager::UpdatePruneLock(const std::string& name, const PruneLockInfo&
m_prune_locks[name] = lock_info;
}
bool BlockManager::DeletePruneLock(const std::string& name)
{
AssertLockHeld(::cs_main);
return m_prune_locks.erase(name) > 0;
}
CBlockIndex* BlockManager::InsertBlockIndex(const uint256& hash)
{
AssertLockHeld(cs_main);

View File

@@ -455,6 +455,9 @@ public:
//! Create or update a prune lock identified by its name
void UpdatePruneLock(const std::string& name, const PruneLockInfo& lock_info) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
//! Delete a prune lock identified by its name. Returns true if the lock existed.
bool DeletePruneLock(const std::string& name) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
/** Open a block file (blk?????.dat) */
AutoFile OpenBlockFile(const FlatFilePos& pos, bool fReadOnly) const;