3 suggestions
Earlier concerns neither republished nor resolved: 1 major finding · 1 suggestion. See the Run archive for their assessments.
Optional improvements
[suggestion] · Flush notification tests discard the error message
A block/undo message mix-up in the refactored helper calls would still pass both new unit tests.
Location: src/test/blockmanager_tests.cpp:47 (head).
Details and suggested fix
Each call site now supplies its error text to FlushFile(), but CountingNotifications::flushError() discards that text and the tests check only the false result and notification count. If FlushUndoFile() accidentally supplied the block-file message, the undo test would still pass while an undo I/O failure would be reported as a block-file failure. The existing chainstate_flush_failure_boundary checks only the block-file message for a blk failure. Record message.original in CountingNotifications and assert that each test receives the corresponding "Flushing block file" or "Flushing undo file" text, while retaining the count assertions.
[suggestion] · FlushFile constructs error messages on successful flushes
Both callers now construct bilingual error strings and invoke any configured translator before flushing, even when the flush succeeds.
Location: src/node/blockstorage.cpp:750 (head).
Details and suggested fix
_() returns a util::TranslatedLiteral, but binding it to this const bilingual_str& parameter invokes operator bilingual_str() during argument initialization. This constructs the original and translated strings before the helper's successful early return, and calls the translator when one is installed, as in the Qt GUI. Previously, conversion happened only after a failed flush. Although minor relative to disk I/O, this work is unnecessary on success. Take util::TranslatedLiteral by value and forward-declare that type in the header instead. Both current callers already pass it, and conversion would then occur only at flushError(flush_error_message), preserving the messages and notification-before-false ordering.
[suggestion] · Undo failure test rebuilds the undo path through std::string
The undo test bypasses fs::path's string-conversion guards and duplicates the block/undo naming convention, although its existing friend accessor can obtain the actual undo path.
Location: src/test/blockmanager_tests.cpp:421 (head).
Details and suggested fix
filename() returns a plain std::filesystem::path, so .string() compiles despite fs::path::string() being deleted to avoid locale-dependent encoding on Windows. Likewise, parent_path() / rev_name rebuilds the path through the standard string conversion. The ASCII filename makes this work today, but the test also duplicates the blk-to-rev naming convention configured by BlockManager. Add an accessor to the already-befriended BlockManagerTest that returns b.m_undo_file_seq.FileName(FlatFilePos{n, 0}), and use that path for the directory injection. This preserves the injected failure without the string round-trip or duplicated naming assumption.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Clarify the scope of the notification guarantee
- [major]: Keep chain and coin state coherent after a failed flush