pub fn save_binary_state(
blockchain_db: &BlockchainDb,
path: &Path,
) -> Result<(), PersistenceError>Expand description
Save the current BlockchainDb state to a binary file.
This extracts accounts (without code) and storage from the MemDb
and serializes them with bincode for fast restoration. Bytecode is excluded
and persisted separately to bytecodes.bin; the saved account info keeps
only the code_hash.
Returns an error if serialization, parent-directory creation, or writing fails, so explicit flush callers can distinguish a successful save from a stale or missing on-disk cache.
The on-disk format carries magic bytes and a version number before the bincode payload. Unknown versions are treated as a cache miss rather than being migrated.