Skip to content

Commit fac36b9

Browse files
author
MarcoFalke
committed
refactor: Remove CBlockFileInfo::SetNull
1 parent fc1073b commit fac36b9

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

src/chain.h

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ static constexpr int64_t MAX_BLOCK_TIME_GAP = 90 * 60;
4242
class CBlockFileInfo
4343
{
4444
public:
45-
unsigned int nBlocks; //!< number of blocks stored in file
46-
unsigned int nSize; //!< number of used bytes of block file
47-
unsigned int nUndoSize; //!< number of used bytes in the undo file
48-
unsigned int nHeightFirst; //!< lowest height of block in file
49-
unsigned int nHeightLast; //!< highest height of block in file
50-
uint64_t nTimeFirst; //!< earliest time of block in file
51-
uint64_t nTimeLast; //!< latest time of block in file
45+
unsigned int nBlocks{}; //!< number of blocks stored in file
46+
unsigned int nSize{}; //!< number of used bytes of block file
47+
unsigned int nUndoSize{}; //!< number of used bytes in the undo file
48+
unsigned int nHeightFirst{}; //!< lowest height of block in file
49+
unsigned int nHeightLast{}; //!< highest height of block in file
50+
uint64_t nTimeFirst{}; //!< earliest time of block in file
51+
uint64_t nTimeLast{}; //!< latest time of block in file
5252

5353
SERIALIZE_METHODS(CBlockFileInfo, obj)
5454
{
@@ -61,21 +61,7 @@ class CBlockFileInfo
6161
READWRITE(VARINT(obj.nTimeLast));
6262
}
6363

64-
void SetNull()
65-
{
66-
nBlocks = 0;
67-
nSize = 0;
68-
nUndoSize = 0;
69-
nHeightFirst = 0;
70-
nHeightLast = 0;
71-
nTimeFirst = 0;
72-
nTimeLast = 0;
73-
}
74-
75-
CBlockFileInfo()
76-
{
77-
SetNull();
78-
}
64+
CBlockFileInfo() {}
7965

8066
std::string ToString() const;
8167

src/node/blockstorage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void BlockManager::PruneOneBlockFile(const int fileNumber)
254254
}
255255
}
256256

257-
m_blockfile_info[fileNumber].SetNull();
257+
m_blockfile_info.at(fileNumber) = CBlockFileInfo{};
258258
m_dirty_fileinfo.insert(fileNumber);
259259
}
260260

src/node/blockstorage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
class BlockValidationState;
3333
class CAutoFile;
3434
class CBlock;
35-
class CBlockFileInfo;
3635
class CBlockUndo;
3736
class CChainParams;
3837
class Chainstate;

0 commit comments

Comments
 (0)