| 2131 | } |
| 2132 | |
| 2133 | void 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 | |
| 2156 | bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize); |
| 2157 |
no test coverage detected