4
4
5
5
#include < node/blockstorage.h>
6
6
7
+ #include < arith_uint256.h>
7
8
#include < chain.h>
8
- #include < clientversion .h>
9
+ #include < consensus/params .h>
9
10
#include < consensus/validation.h>
10
11
#include < dbwrapper.h>
11
12
#include < flatfile.h>
12
13
#include < hash.h>
13
- #include < kernel/chain .h>
14
+ #include < kernel/blockmanager_opts .h>
14
15
#include < kernel/chainparams.h>
15
16
#include < kernel/messagestartchars.h>
17
+ #include < kernel/notifications_interface.h>
16
18
#include < logging.h>
17
19
#include < pow.h>
20
+ #include < primitives/block.h>
21
+ #include < primitives/transaction.h>
18
22
#include < reverse_iterator.h>
23
+ #include < serialize.h>
19
24
#include < signet.h>
25
+ #include < span.h>
20
26
#include < streams.h>
21
27
#include < sync.h>
28
+ #include < tinyformat.h>
29
+ #include < uint256.h>
22
30
#include < undo.h>
23
31
#include < util/batchpriority.h>
32
+ #include < util/check.h>
24
33
#include < util/fs.h>
25
34
#include < util/signalinterrupt.h>
26
35
#include < util/strencodings.h>
@@ -656,7 +665,7 @@ CBlockFileInfo* BlockManager::GetBlockFileInfo(size_t n)
656
665
bool BlockManager::UndoWriteToDisk (const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock) const
657
666
{
658
667
// Open history file to append
659
- CAutoFile fileout{OpenUndoFile (pos)};
668
+ AutoFile fileout{OpenUndoFile (pos)};
660
669
if (fileout.IsNull ()) {
661
670
return error (" %s: OpenUndoFile failed" , __func__);
662
671
}
@@ -691,7 +700,7 @@ bool BlockManager::UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex& in
691
700
}
692
701
693
702
// Open history file to read
694
- CAutoFile filein{OpenUndoFile (pos, true )};
703
+ AutoFile filein{OpenUndoFile (pos, true )};
695
704
if (filein.IsNull ()) {
696
705
return error (" %s: OpenUndoFile failed" , __func__);
697
706
}
@@ -810,15 +819,15 @@ FlatFileSeq BlockManager::UndoFileSeq() const
810
819
return FlatFileSeq (m_opts.blocks_dir , " rev" , UNDOFILE_CHUNK_SIZE);
811
820
}
812
821
813
- CAutoFile BlockManager::OpenBlockFile (const FlatFilePos& pos, bool fReadOnly ) const
822
+ AutoFile BlockManager::OpenBlockFile (const FlatFilePos& pos, bool fReadOnly ) const
814
823
{
815
- return CAutoFile {BlockFileSeq ().Open (pos, fReadOnly ), CLIENT_VERSION };
824
+ return AutoFile {BlockFileSeq ().Open (pos, fReadOnly )};
816
825
}
817
826
818
827
/* * Open an undo file (rev?????.dat) */
819
- CAutoFile BlockManager::OpenUndoFile (const FlatFilePos& pos, bool fReadOnly ) const
828
+ AutoFile BlockManager::OpenUndoFile (const FlatFilePos& pos, bool fReadOnly ) const
820
829
{
821
- return CAutoFile {UndoFileSeq ().Open (pos, fReadOnly ), CLIENT_VERSION };
830
+ return AutoFile {UndoFileSeq ().Open (pos, fReadOnly )};
822
831
}
823
832
824
833
fs::path BlockManager::GetBlockPosFilename (const FlatFilePos& pos) const
@@ -950,7 +959,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
950
959
bool BlockManager::WriteBlockToDisk (const CBlock& block, FlatFilePos& pos) const
951
960
{
952
961
// Open history file to append
953
- CAutoFile fileout{OpenBlockFile (pos)};
962
+ AutoFile fileout{OpenBlockFile (pos)};
954
963
if (fileout.IsNull ()) {
955
964
return error (" WriteBlockToDisk: OpenBlockFile failed" );
956
965
}
@@ -1016,7 +1025,7 @@ bool BlockManager::ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos) cons
1016
1025
block.SetNull ();
1017
1026
1018
1027
// Open history file to read
1019
- CAutoFile filein{OpenBlockFile (pos, true )};
1028
+ AutoFile filein{OpenBlockFile (pos, true )};
1020
1029
if (filein.IsNull ()) {
1021
1030
return error (" ReadBlockFromDisk: OpenBlockFile failed for %s" , pos.ToString ());
1022
1031
}
@@ -1059,7 +1068,7 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
1059
1068
{
1060
1069
FlatFilePos hpos = pos;
1061
1070
hpos.nPos -= 8 ; // Seek back 8 bytes for meta header
1062
- CAutoFile filein{OpenBlockFile (hpos, true )};
1071
+ AutoFile filein{OpenBlockFile (hpos, true )};
1063
1072
if (filein.IsNull ()) {
1064
1073
return error (" %s: OpenBlockFile failed for %s" , __func__, pos.ToString ());
1065
1074
}
@@ -1151,7 +1160,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
1151
1160
if (!fs::exists (chainman.m_blockman .GetBlockPosFilename (pos))) {
1152
1161
break ; // No block files left to reindex
1153
1162
}
1154
- CAutoFile file{chainman.m_blockman .OpenBlockFile (pos, true )};
1163
+ AutoFile file{chainman.m_blockman .OpenBlockFile (pos, true )};
1155
1164
if (file.IsNull ()) {
1156
1165
break ; // This error is logged in OpenBlockFile
1157
1166
}
@@ -1172,7 +1181,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
1172
1181
1173
1182
// -loadblock=
1174
1183
for (const fs::path& path : vImportFiles) {
1175
- CAutoFile file{fsbridge::fopen (path, " rb" ), CLIENT_VERSION };
1184
+ AutoFile file{fsbridge::fopen (path, " rb" )};
1176
1185
if (!file.IsNull ()) {
1177
1186
LogPrintf (" Importing blocks file %s...\n " , fs::PathToString (path));
1178
1187
chainman.LoadExternalBlockFile (file);
0 commit comments