zebra/zebra-chain
Arya 0ef9987e9e
fix(state): Write database format version to disk atomically to avoid a rare panic (#8795)
* Splits `atomic_write_to_tmp_file` out of `zebra_network::Config::update_peer_cache`

* Uses the new `atomic_write_to_tmp_file` fn in `update_peer_cache()`

* Replaces repetitive code for getting the default peer and state cache directories with `default_cache_dir()`

* Converts `atomic_write_to_tmp_file` to a blocking function and adds `spawn_atomic_write_to_tmp_file` for use in async environments.

* Uses `atomic_write_to_tmp_file` to write database versions to disk

* Removes `spawn_atomic_write_to_tmp_file()` and inlines its body at its callsite to avoid adding tokio as a dependency of zebra-chain.

* Apply suggestions from code review

Co-authored-by: Marek <mail@marek.onl>

---------

Co-authored-by: Marek <mail@marek.onl>
2024-08-29 21:09:27 +00:00
..
benches use `reddsa` crate and remove duplicated RedPallas code (#6013) 2023-02-01 23:27:28 +00:00
proptest-regressions Split out parsing & validation of test VerificationKey from checking of the signature (#2228) 2021-06-01 15:59:34 +10:00
src fix(state): Write database format version to disk atomically to avoid a rare panic (#8795) 2024-08-29 21:09:27 +00:00
Cargo.toml fix(state): Write database format version to disk atomically to avoid a rare panic (#8795) 2024-08-29 21:09:27 +00:00