diff options
author | Jon Atack <jon@atack.com> | 2022-04-27 12:21:22 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2022-04-28 20:42:08 +0200 |
commit | ed12c0a49d3c64d170aca9e66ef32a57d7933eeb (patch) | |
tree | 6f74d670d7c39c3cdd4531e48156f5e3fc6757a6 /src/node | |
parent | dabec990135cc32584e822126ec49f8b31350837 (diff) |
blockstorage, refactor: make GetFirstStoredBlock() a member of BlockManager
instead of a global
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/blockstorage.cpp | 3 | ||||
-rw-r--r-- | src/node/blockstorage.h | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 25771aacee..be45eb7ba9 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -390,7 +390,8 @@ bool BlockManager::IsBlockPruned(const CBlockIndex* pblockindex) return (m_have_pruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0); } -const CBlockIndex* GetFirstStoredBlock(const CBlockIndex* start_block) { +const CBlockIndex* BlockManager::GetFirstStoredBlock(const CBlockIndex* start_block) +{ AssertLockHeld(::cs_main); assert(start_block); const CBlockIndex* last_block = start_block; diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h index 622eac7fef..c5317e5a95 100644 --- a/src/node/blockstorage.h +++ b/src/node/blockstorage.h @@ -178,6 +178,9 @@ public: //! Returns last CBlockIndex* that is a checkpoint const CBlockIndex* GetLastCheckpoint(const CCheckpointData& data) EXCLUSIVE_LOCKS_REQUIRED(cs_main); + //! Find the first block that is not pruned + const CBlockIndex* GetFirstStoredBlock(const CBlockIndex* start_block) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); + /** True if any block files have ever been pruned. */ bool m_have_pruned = false; @@ -188,9 +191,6 @@ public: void UpdatePruneLock(const std::string& name, const PruneLockInfo& lock_info) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); }; -//! Find the first block that is not pruned -const CBlockIndex* GetFirstStoredBlock(const CBlockIndex* start_block) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); - void CleanupBlockRevFiles(); /** Open a block file (blk?????.dat) */ |