This is a follow-up to #35714 as it has the two commits of that PR, do not merge or review before that PR
#35714 makes FlushStateToDisk() return state.Error(...) when FlushChainstateBlockFile() fails, relying on the comment // FlushChainstateBlockFile() already emitted the flush-error notification.
That invariant holds today, but it is not guaranteed by construction: it depends on every success = false branch inside FlushBlockFile/FlushUndoFile emitting the notification on its own. A future flush source (a new file type, a new error branch) that sets success = false without notifying would make FlushStateToDisk() return an error without AbortNode().
This PR makes sure that whenever a flush reports failure, the flush-error notification has been emitted:
- test: cover FlushBlockFile flush-error notifications: lower-level
BlockManagertests (as suggested in the #35714 review) that inject a failure on the block file and on the undo file separately and assert each failure emitsflushError. - blockstorage: encapsulate flush+notify in FlushFile: a single
FlushFile()helper couples the flush and the notification;FlushBlockFile/FlushUndoFiledelegate to it. Behaviour is unchanged.