streams: cache file position within AutoFile

Github-Pull: bitcoin/bitcoin#30884
Rebased-From: e624a9bef1
This commit is contained in:
Pieter Wuille
2024-09-12 10:40:19 -04:00
committed by Ava Chow
parent 1b853fdb0a
commit 8229e98116
8 changed files with 48 additions and 35 deletions

View File

@@ -683,7 +683,7 @@ bool BlockManager::UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos
fileout << GetParams().MessageStart() << nSize;
// Write undo data
long fileOutPos = ftell(fileout.Get());
long fileOutPos = fileout.tell();
if (fileOutPos < 0) {
LogError("%s: ftell failed\n", __func__);
return false;
@@ -981,7 +981,7 @@ bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos) const
fileout << GetParams().MessageStart() << nSize;
// Write block
long fileOutPos = ftell(fileout.Get());
long fileOutPos = fileout.tell();
if (fileOutPos < 0) {
LogError("%s: ftell failed\n", __func__);
return false;