MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / FlushBlockFile

Function FlushBlockFile

src/main.cpp:2133–2154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2131}
2132
2133void static FlushBlockFile(bool fFinalize = false)
2134{
2135 LOCK(cs_LastBlockFile);
2136
2137 CDiskBlockPos posOld(nLastBlockFile, 0);
2138
2139 FILE *fileOld = OpenBlockFile(posOld);
2140 if (fileOld) {
2141 if (fFinalize)
2142 TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nSize);
2143 FileCommit(fileOld);
2144 fclose(fileOld);
2145 }
2146
2147 fileOld = OpenUndoFile(posOld);
2148 if (fileOld) {
2149 if (fFinalize)
2150 TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nUndoSize);
2151 FileCommit(fileOld);
2152 fclose(fileOld);
2153 }
2154}
2155
2156bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
2157

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