@@ -734,7 +734,7 @@ bool BlockManager::UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex& in
734
734
bool BlockManager::FlushUndoFile (int block_file, bool finalize)
735
735
{
736
736
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)) {
738
738
m_opts.notifications .flushError (_ (" Flushing undo file to disk failed. This is likely the result of an I/O error." ));
739
739
return false ;
740
740
}
@@ -756,7 +756,7 @@ bool BlockManager::FlushBlockFile(int blockfile_num, bool fFinalize, bool finali
756
756
assert (static_cast <int >(m_blockfile_info.size ()) > blockfile_num);
757
757
758
758
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 )) {
760
760
m_opts.notifications .flushError (_ (" Flushing block file to disk failed. This is likely the result of an I/O error." ));
761
761
success = false ;
762
762
}
@@ -808,38 +808,28 @@ void BlockManager::UnlinkPrunedFiles(const std::set<int>& setFilesToPrune) const
808
808
std::error_code ec;
809
809
for (std::set<int >::iterator it = setFilesToPrune.begin (); it != setFilesToPrune.end (); ++it) {
810
810
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)};
813
813
if (removed_blockfile || removed_undofile) {
814
814
LogPrint (BCLog::BLOCKSTORAGE, " Prune: %s deleted blk/rev (%05u)\n " , __func__, *it);
815
815
}
816
816
}
817
817
}
818
818
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
-
829
819
AutoFile BlockManager::OpenBlockFile (const FlatFilePos& pos, bool fReadOnly ) const
830
820
{
831
- return AutoFile{BlockFileSeq () .Open (pos, fReadOnly )};
821
+ return AutoFile{m_block_file_seq .Open (pos, fReadOnly )};
832
822
}
833
823
834
824
/* * Open an undo file (rev?????.dat) */
835
825
AutoFile BlockManager::OpenUndoFile (const FlatFilePos& pos, bool fReadOnly ) const
836
826
{
837
- return AutoFile{UndoFileSeq () .Open (pos, fReadOnly )};
827
+ return AutoFile{m_undo_file_seq .Open (pos, fReadOnly )};
838
828
}
839
829
840
830
fs::path BlockManager::GetBlockPosFilename (const FlatFilePos& pos) const
841
831
{
842
- return BlockFileSeq () .FileName (pos);
832
+ return m_block_file_seq .FileName (pos);
843
833
}
844
834
845
835
FlatFilePos BlockManager::FindNextBlockPos (unsigned int nAddSize, unsigned int nHeight, uint64_t nTime)
@@ -919,7 +909,7 @@ FlatFilePos BlockManager::FindNextBlockPos(unsigned int nAddSize, unsigned int n
919
909
m_blockfile_info[nFile].nSize += nAddSize;
920
910
921
911
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);
923
913
if (out_of_space) {
924
914
m_opts.notifications .fatalError (_ (" Disk space is too low!" ));
925
915
return {};
@@ -965,7 +955,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
965
955
m_dirty_fileinfo.insert (nFile);
966
956
967
957
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);
969
959
if (out_of_space) {
970
960
return FatalError (m_opts.notifications , state, _ (" Disk space is too low!" ));
971
961
}
0 commit comments