Make BufferedFile to be a CAutoFile wrapper

This refactor allows to forward some calls to the underlying CAutoFile,
instead of re-implementing the logic in the buffered file.
This commit is contained in:
MarcoFalke
2023-07-04 17:09:13 +02:00
parent fa389d902f
commit 9999b89cd3
9 changed files with 23 additions and 27 deletions

View File

@@ -4577,7 +4577,7 @@ bool Chainstate::LoadGenesisBlock()
}
void ChainstateManager::LoadExternalBlockFile(
FILE* fileIn,
CAutoFile& file_in,
FlatFilePos* dbp,
std::multimap<uint256, FlatFilePos>* blocks_with_unknown_parent)
{
@@ -4589,7 +4589,7 @@ void ChainstateManager::LoadExternalBlockFile(
int nLoaded = 0;
try {
BufferedFile blkdat{fileIn, 2 * MAX_BLOCK_SERIALIZED_SIZE, MAX_BLOCK_SERIALIZED_SIZE + 8, CLIENT_VERSION};
BufferedFile blkdat{file_in, 2 * MAX_BLOCK_SERIALIZED_SIZE, MAX_BLOCK_SERIALIZED_SIZE + 8};
// nRewind indicates where to resume scanning in case something goes wrong,
// such as a block fails to deserialize.
uint64_t nRewind = blkdat.GetPos();