| 687 | } |
| 688 | |
| 689 | void static FlushBlockFile(bool fFinalize = false) { |
| 690 | LOCK(cs_LastBlockFile); |
| 691 | |
| 692 | CDiskBlockPos posOld(nLastBlockFile, 0); |
| 693 | |
| 694 | FILE *fileOld = OpenBlockFile(posOld); |
| 695 | if (fileOld) { |
| 696 | if (fFinalize) |
| 697 | TruncateFile(fileOld, infoLastBlockFile.nSize); |
| 698 | FileCommit(fileOld); |
| 699 | fclose(fileOld); |
| 700 | } |
| 701 | |
| 702 | fileOld = OpenUndoFile(posOld); |
| 703 | if (fileOld) { |
| 704 | if (fFinalize) |
| 705 | TruncateFile(fileOld, infoLastBlockFile.nUndoSize); |
| 706 | FileCommit(fileOld); |
| 707 | fclose(fileOld); |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | static bool FindUndoPos(CValidationState &state, int32_t nFile, CDiskBlockPos &pos, uint32_t nAddSize) { |
| 712 | pos.nFile = nFile; |
no test coverage detected