| 795 | } |
| 796 | |
| 797 | bool BlockManager::FlushChainstateBlockFile(int tip_height) |
| 798 | { |
| 799 | AssertLockHeld(::cs_main); |
| 800 | auto& cursor = m_blockfile_cursors[BlockfileTypeForHeight(tip_height)]; |
| 801 | // If the cursor does not exist, it means an assumeutxo snapshot is loaded, |
| 802 | // but no blocks past the snapshot height have been written yet, so there |
| 803 | // is no data associated with the chainstate, and it is safe not to flush. |
| 804 | if (cursor) { |
| 805 | return FlushBlockFile(cursor->file_num, /*fFinalize=*/false, /*finalize_undo=*/false); |
| 806 | } |
| 807 | // No need to log warnings in this case. |
| 808 | return true; |
| 809 | } |
| 810 | |
| 811 | uint64_t BlockManager::CalculateCurrentUsage() |
| 812 | { |