refactor: Remove CBlockFileInfo::SetNull

This commit is contained in:
MarcoFalke 2023-10-20 13:28:11 +02:00
parent fc1073bb45
commit fac36b94ef
No known key found for this signature in database
3 changed files with 9 additions and 24 deletions

View File

@ -42,13 +42,13 @@ static constexpr int64_t MAX_BLOCK_TIME_GAP = 90 * 60;
class CBlockFileInfo class CBlockFileInfo
{ {
public: public:
unsigned int nBlocks; //!< number of blocks stored in file unsigned int nBlocks{}; //!< number of blocks stored in file
unsigned int nSize; //!< number of used bytes of block file unsigned int nSize{}; //!< number of used bytes of block file
unsigned int nUndoSize; //!< number of used bytes in the undo file unsigned int nUndoSize{}; //!< number of used bytes in the undo file
unsigned int nHeightFirst; //!< lowest height of block in file unsigned int nHeightFirst{}; //!< lowest height of block in file
unsigned int nHeightLast; //!< highest height of block in file unsigned int nHeightLast{}; //!< highest height of block in file
uint64_t nTimeFirst; //!< earliest time of block in file uint64_t nTimeFirst{}; //!< earliest time of block in file
uint64_t nTimeLast; //!< latest time of block in file uint64_t nTimeLast{}; //!< latest time of block in file
SERIALIZE_METHODS(CBlockFileInfo, obj) SERIALIZE_METHODS(CBlockFileInfo, obj)
{ {
@ -61,21 +61,7 @@ public:
READWRITE(VARINT(obj.nTimeLast)); READWRITE(VARINT(obj.nTimeLast));
} }
void SetNull() CBlockFileInfo() {}
{
nBlocks = 0;
nSize = 0;
nUndoSize = 0;
nHeightFirst = 0;
nHeightLast = 0;
nTimeFirst = 0;
nTimeLast = 0;
}
CBlockFileInfo()
{
SetNull();
}
std::string ToString() const; std::string ToString() const;

View File

@ -254,7 +254,7 @@ void BlockManager::PruneOneBlockFile(const int fileNumber)
} }
} }
m_blockfile_info[fileNumber].SetNull(); m_blockfile_info.at(fileNumber) = CBlockFileInfo{};
m_dirty_fileinfo.insert(fileNumber); m_dirty_fileinfo.insert(fileNumber);
} }

View File

@ -32,7 +32,6 @@
class BlockValidationState; class BlockValidationState;
class CAutoFile; class CAutoFile;
class CBlock; class CBlock;
class CBlockFileInfo;
class CBlockUndo; class CBlockUndo;
class CChainParams; class CChainParams;
class Chainstate; class Chainstate;