MCPcopy Create free account
hub / github.com/LUX-Core/lux / FlushBlockFile

Function FlushBlockFile

src/main.cpp:2557–2578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2555}
2556
2557void static FlushBlockFile(bool fFinalize = false)
2558{
2559 LOCK(cs_LastBlockFile);
2560
2561 CDiskBlockPos posOld(nLastBlockFile, 0);
2562
2563 FILE* fileOld = OpenBlockFile(posOld);
2564 if (fileOld) {
2565 if (fFinalize)
2566 TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nSize);
2567 FileCommit(fileOld);
2568 fclose(fileOld);
2569 }
2570
2571 fileOld = OpenUndoFile(posOld);
2572 if (fileOld) {
2573 if (fFinalize)
2574 TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nUndoSize);
2575 FileCommit(fileOld);
2576 fclose(fileOld);
2577 }
2578}
2579
2580bool FindUndoPos(CValidationState& state, int nFile, CDiskBlockPos& pos, unsigned int nAddSize);
2581

Callers 2

FlushStateToDiskFunction · 0.85
FindBlockPosFunction · 0.85

Calls 4

OpenBlockFileFunction · 0.85
TruncateFileFunction · 0.85
FileCommitFunction · 0.85
OpenUndoFileFunction · 0.85

Tested by

no test coverage detected