diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-01-04 15:00:34 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-01-05 16:18:50 +0100 |
commit | facd3df21f344dd84e5f28862056700c1fded17c (patch) | |
tree | c6d17c7d72a95db54574f88ce3d44ab6d4e61bc1 /src/node | |
parent | faa8c2d7d75f8d9782709e73e00e35851e233392 (diff) |
Make blockstorage globals private members of BlockManager
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/blockstorage.cpp | 17 | ||||
-rw-r--r-- | src/node/blockstorage.h | 18 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index a040f2e7b4..cad93a2df9 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -27,23 +27,6 @@ bool fHavePruned = false; bool fPruneMode = false; uint64_t nPruneTarget = 0; -// TODO make namespace { -RecursiveMutex cs_LastBlockFile; -std::vector<CBlockFileInfo> vinfoBlockFile; -int nLastBlockFile = 0; -/** Global flag to indicate we should check to see if there are -* block/undo files that should be deleted. Set on startup -* or if we allocate more file space when we're in prune mode -*/ -bool fCheckForPruning = false; - -/** Dirty block index entries. */ -std::set<CBlockIndex*> setDirtyBlockIndex; - -/** Dirty block file entries. */ -std::set<int> setDirtyFileInfo; -// } // namespace - static FILE* OpenUndoFile(const FlatFilePos& pos, bool fReadOnly = false); static FlatFileSeq BlockFileSeq(); static FlatFileSeq UndoFileSeq(); diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h index 020117ce74..d5f041612d 100644 --- a/src/node/blockstorage.h +++ b/src/node/blockstorage.h @@ -64,6 +64,7 @@ struct CBlockIndexWorkComparator { class BlockManager { friend CChainState; + friend ChainstateManager; private: void FlushBlockFile(bool fFinalize = false, bool finalize_undo = false); @@ -80,7 +81,7 @@ private: * space is allocated in a block or undo file, staying below the target. Changing back to unpruned requires a reindex * (which in this case means the blockchain must be re-downloaded.) * - * Pruning functions are called from FlushStateToDisk when the global fCheckForPruning flag has been set. + * Pruning functions are called from FlushStateToDisk when the fCheckForPruning flag has been set. * Block and undo files are deleted in lock-step (when blk00003.dat is deleted, so is rev00003.dat.) * Pruning cannot take place until the longest chain is at least a certain length (CChainParams::nPruneAfterHeight). * Pruning will never delete a block within a defined distance (currently 288) from the active chain's tip. @@ -91,6 +92,21 @@ private: */ void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight, int chain_tip_height, int prune_height, bool is_ibd); + RecursiveMutex cs_LastBlockFile; + std::vector<CBlockFileInfo> vinfoBlockFile; + int nLastBlockFile = 0; + /** Global flag to indicate we should check to see if there are + * block/undo files that should be deleted. Set on startup + * or if we allocate more file space when we're in prune mode + */ + bool fCheckForPruning = false; + + /** Dirty block index entries. */ + std::set<CBlockIndex*> setDirtyBlockIndex; + + /** Dirty block file entries. */ + std::set<int> setDirtyFileInfo; + public: BlockMap m_block_index GUARDED_BY(cs_main); |