@@ -459,7 +459,7 @@ bool BlockManager::LoadBlockIndexDB()
459
459
}
460
460
for (std::set<int >::iterator it = setBlkDataFiles.begin (); it != setBlkDataFiles.end (); it++) {
461
461
FlatFilePos pos (*it, 0 );
462
- if (AutoFile{ OpenBlockFile (pos, true )} .IsNull ()) {
462
+ if (OpenBlockFile (pos, true ).IsNull ()) {
463
463
return false ;
464
464
}
465
465
}
@@ -592,7 +592,7 @@ CBlockFileInfo* BlockManager::GetBlockFileInfo(size_t n)
592
592
bool BlockManager::UndoWriteToDisk (const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock) const
593
593
{
594
594
// Open history file to append
595
- AutoFile fileout{OpenUndoFile (pos)};
595
+ CAutoFile fileout{OpenUndoFile (pos)};
596
596
if (fileout.IsNull ()) {
597
597
return error (" %s: OpenUndoFile failed" , __func__);
598
598
}
@@ -627,7 +627,7 @@ bool BlockManager::UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex& in
627
627
}
628
628
629
629
// Open history file to read
630
- AutoFile filein{OpenUndoFile (pos, true )};
630
+ CAutoFile filein{OpenUndoFile (pos, true )};
631
631
if (filein.IsNull ()) {
632
632
return error (" %s: OpenUndoFile failed" , __func__);
633
633
}
@@ -715,15 +715,15 @@ FlatFileSeq BlockManager::UndoFileSeq() const
715
715
return FlatFileSeq (m_opts.blocks_dir , " rev" , UNDOFILE_CHUNK_SIZE);
716
716
}
717
717
718
- FILE* BlockManager::OpenBlockFile (const FlatFilePos& pos, bool fReadOnly ) const
718
+ CAutoFile BlockManager::OpenBlockFile (const FlatFilePos& pos, bool fReadOnly ) const
719
719
{
720
- return BlockFileSeq ().Open (pos, fReadOnly );
720
+ return CAutoFile{ BlockFileSeq ().Open (pos, fReadOnly ), CLIENT_VERSION} ;
721
721
}
722
722
723
723
/* * Open an undo file (rev?????.dat) */
724
- FILE* BlockManager::OpenUndoFile (const FlatFilePos& pos, bool fReadOnly ) const
724
+ CAutoFile BlockManager::OpenUndoFile (const FlatFilePos& pos, bool fReadOnly ) const
725
725
{
726
- return UndoFileSeq ().Open (pos, fReadOnly );
726
+ return CAutoFile{ UndoFileSeq ().Open (pos, fReadOnly ), CLIENT_VERSION} ;
727
727
}
728
728
729
729
fs::path BlockManager::GetBlockPosFilename (const FlatFilePos& pos) const
@@ -824,7 +824,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
824
824
bool BlockManager::WriteBlockToDisk (const CBlock& block, FlatFilePos& pos) const
825
825
{
826
826
// Open history file to append
827
- CAutoFile fileout{OpenBlockFile (pos), CLIENT_VERSION };
827
+ CAutoFile fileout{OpenBlockFile (pos)};
828
828
if (fileout.IsNull ()) {
829
829
return error (" WriteBlockToDisk: OpenBlockFile failed" );
830
830
}
@@ -880,7 +880,7 @@ bool BlockManager::ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos) cons
880
880
block.SetNull ();
881
881
882
882
// Open history file to read
883
- CAutoFile filein{OpenBlockFile (pos, true ), CLIENT_VERSION };
883
+ CAutoFile filein{OpenBlockFile (pos, true )};
884
884
if (filein.IsNull ()) {
885
885
return error (" ReadBlockFromDisk: OpenBlockFile failed for %s" , pos.ToString ());
886
886
}
@@ -923,7 +923,7 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
923
923
{
924
924
FlatFilePos hpos = pos;
925
925
hpos.nPos -= 8 ; // Seek back 8 bytes for meta header
926
- AutoFile filein{OpenBlockFile (hpos, true )};
926
+ CAutoFile filein{OpenBlockFile (hpos, true )};
927
927
if (filein.IsNull ()) {
928
928
return error (" %s: OpenBlockFile failed for %s" , __func__, pos.ToString ());
929
929
}
@@ -1015,7 +1015,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
1015
1015
if (!fs::exists (chainman.m_blockman .GetBlockPosFilename (pos))) {
1016
1016
break ; // No block files left to reindex
1017
1017
}
1018
- CAutoFile file{chainman.m_blockman .OpenBlockFile (pos, true ), CLIENT_VERSION };
1018
+ CAutoFile file{chainman.m_blockman .OpenBlockFile (pos, true )};
1019
1019
if (file.IsNull ()) {
1020
1020
break ; // This error is logged in OpenBlockFile
1021
1021
}
0 commit comments