aboutsummaryrefslogtreecommitdiff
path: root/src/node/blockstorage.h
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2023-07-25 12:03:26 +0200
committerTheCharlatan <seb.kung@gmail.com>2023-08-31 23:26:51 +0200
commitd8041d4e042957660827313951b18c8dd9a99a16 (patch)
treebedb874cd7d8877bf25758d5da491ea49dbdfebf /src/node/blockstorage.h
parentf0207e00303a1030eca795ede231e3c0d94df061 (diff)
downloadbitcoin-d8041d4e042957660827313951b18c8dd9a99a16.tar.xz
blockstorage: Return on fatal undo file flush error
By returning an error code if either `FlushUndoFile` or `FlushBlockFile` fail, the caller now has to explicitly handle block undo file flushing errors. Before this change such errors were non-explicitly ignored without a clear rationale. Besides the call to `FlushUndoFile` in `FlushBlockFile`, ignore its return code at its call site in `WriteUndoDataForBlock`. There, a failed flush of the undo data should not be indicative of a failed write. Add [[nodiscard]] annotations to `FlushUndoFile` such that its return value is not just ignored in the future.
Diffstat (limited to 'src/node/blockstorage.h')
-rw-r--r--src/node/blockstorage.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h
index 3e0962386f..9950d9c477 100644
--- a/src/node/blockstorage.h
+++ b/src/node/blockstorage.h
@@ -92,10 +92,12 @@ private:
bool LoadBlockIndex()
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
- /** Return false if block file flushing fails. */
+ /** Return false if block file or undo file flushing fails. */
[[nodiscard]] bool FlushBlockFile(bool fFinalize = false, bool finalize_undo = false);
- void FlushUndoFile(int block_file, bool finalize = false);
+ /** Return false if undo file flushing fails. */
+ [[nodiscard]] bool FlushUndoFile(int block_file, bool finalize = false);
+
[[nodiscard]] bool FindBlockPos(FlatFilePos& pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown);
bool FindUndoPos(BlockValidationState& state, int nFile, FlatFilePos& pos, unsigned int nAddSize);