FlushStateToDisk() returns state.Error(...) when FlushChainstateBlockFile() fails, relying on the invariant that the flush-error notification has already been emitted (so the node is aborted). Today that invariant holds only because every success = false branch in FlushBlockFile/FlushUndoFile happens to call flushError() itself. A future flush source, or a new error branch, that fails without notifying would make FlushStateToDisk() report an error without AbortNode() being triggered.
This PR makes that invariant hold by construction: whenever a flush reports failure, the flush-error notification has been emitted.
- test: cover FlushBlockFile flush-error notifications:
BlockManagerunit tests that inject a failure on the block file and on the undo file separately, and assert that each failure emitsflushError. - blockstorage: encapsulate flush+notify in FlushFile: a single
FlushFile()helper performs the flush and emits the notification on failure;FlushBlockFileandFlushUndoFiledelegate to it. No behaviour change.
Follow-up to #35714. Possible further work on flush error handling is listed in #35714#pullrequestreview-5697890316 (pruned-file deletion after a failed flush is handled in #36735).