@@ -734,7 +734,7 @@ bool BlockManager::UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex& in
734734bool BlockManager::FlushUndoFile (int block_file, bool finalize)
735735{
736736 FlatFilePos undo_pos_old (block_file, m_blockfile_info[block_file].nUndoSize );
737- if (!UndoFileSeq () .Flush (undo_pos_old, finalize)) {
737+ if (!m_undo_file_seq .Flush (undo_pos_old, finalize)) {
738738 m_opts.notifications .flushError (_ (" Flushing undo file to disk failed. This is likely the result of an I/O error." ));
739739 return false ;
740740 }
@@ -756,7 +756,7 @@ bool BlockManager::FlushBlockFile(int blockfile_num, bool fFinalize, bool finali
756756 assert (static_cast <int >(m_blockfile_info.size ()) > blockfile_num);
757757
758758 FlatFilePos block_pos_old (blockfile_num, m_blockfile_info[blockfile_num].nSize );
759- if (!BlockFileSeq () .Flush (block_pos_old, fFinalize )) {
759+ if (!m_block_file_seq .Flush (block_pos_old, fFinalize )) {
760760 m_opts.notifications .flushError (_ (" Flushing block file to disk failed. This is likely the result of an I/O error." ));
761761 success = false ;
762762 }
@@ -808,38 +808,28 @@ void BlockManager::UnlinkPrunedFiles(const std::set<int>& setFilesToPrune) const
808808 std::error_code ec;
809809 for (std::set<int >::iterator it = setFilesToPrune.begin (); it != setFilesToPrune.end (); ++it) {
810810 FlatFilePos pos (*it, 0 );
811- const bool removed_blockfile{fs::remove (BlockFileSeq () .FileName (pos), ec)};
812- const bool removed_undofile{fs::remove (UndoFileSeq () .FileName (pos), ec)};
811+ const bool removed_blockfile{fs::remove (m_block_file_seq .FileName (pos), ec)};
812+ const bool removed_undofile{fs::remove (m_undo_file_seq .FileName (pos), ec)};
813813 if (removed_blockfile || removed_undofile) {
814814 LogPrint (BCLog::BLOCKSTORAGE, " Prune: %s deleted blk/rev (%05u)\n " , __func__, *it);
815815 }
816816 }
817817}
818818
819- FlatFileSeq BlockManager::BlockFileSeq () const
820- {
821- return FlatFileSeq (m_opts.blocks_dir , " blk" , m_opts.fast_prune ? 0x4000 /* 16kb */ : BLOCKFILE_CHUNK_SIZE);
822- }
823-
824- FlatFileSeq BlockManager::UndoFileSeq () const
825- {
826- return FlatFileSeq (m_opts.blocks_dir , " rev" , UNDOFILE_CHUNK_SIZE);
827- }
828-
829819AutoFile BlockManager::OpenBlockFile (const FlatFilePos& pos, bool fReadOnly ) const
830820{
831- return AutoFile{BlockFileSeq () .Open (pos, fReadOnly )};
821+ return AutoFile{m_block_file_seq .Open (pos, fReadOnly )};
832822}
833823
834824/* * Open an undo file (rev?????.dat) */
835825AutoFile BlockManager::OpenUndoFile (const FlatFilePos& pos, bool fReadOnly ) const
836826{
837- return AutoFile{UndoFileSeq () .Open (pos, fReadOnly )};
827+ return AutoFile{m_undo_file_seq .Open (pos, fReadOnly )};
838828}
839829
840830fs::path BlockManager::GetBlockPosFilename (const FlatFilePos& pos) const
841831{
842- return BlockFileSeq () .FileName (pos);
832+ return m_block_file_seq .FileName (pos);
843833}
844834
845835FlatFilePos BlockManager::FindNextBlockPos (unsigned int nAddSize, unsigned int nHeight, uint64_t nTime)
@@ -919,7 +909,7 @@ FlatFilePos BlockManager::FindNextBlockPos(unsigned int nAddSize, unsigned int n
919909 m_blockfile_info[nFile].nSize += nAddSize;
920910
921911 bool out_of_space;
922- size_t bytes_allocated = BlockFileSeq () .Allocate (pos, nAddSize, out_of_space);
912+ size_t bytes_allocated = m_block_file_seq .Allocate (pos, nAddSize, out_of_space);
923913 if (out_of_space) {
924914 m_opts.notifications .fatalError (_ (" Disk space is too low!" ));
925915 return {};
@@ -965,7 +955,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
965955 m_dirty_fileinfo.insert (nFile);
966956
967957 bool out_of_space;
968- size_t bytes_allocated = UndoFileSeq () .Allocate (pos, nAddSize, out_of_space);
958+ size_t bytes_allocated = m_undo_file_seq .Allocate (pos, nAddSize, out_of_space);
969959 if (out_of_space) {
970960 return FatalError (m_opts.notifications , state, _ (" Disk space is too low!" ));
971961 }
0 commit comments