cuprated/blockchain/
fast_sync.rs

1use std::slice;
2
3use cuprate_helper::network::Network;
4
5/// The hashes of the compiled in fast sync file.
6///
7/// See `build.rs` for how this file is generated.
8static FAST_SYNC_HASHES: &[[u8; 32]] = &include!(concat!(env!("OUT_DIR"), "/fast_sync_hashes.rs"));
9
10/// Set the fast-sync hashes according to the provided values.
11pub fn set_fast_sync_hashes(fast_sync: bool, network: Network) {
12    cuprate_fast_sync::set_fast_sync_hashes(if fast_sync && network == Network::Mainnet {
13        FAST_SYNC_HASHES
14    } else {
15        &[]
16    });
17}
18
19#[cfg(test)]
20mod test {
21    use super::*;
22
23    /// Sanity check the fast sync hashes array.
24    #[test]
25    fn length() {
26        assert!(FAST_SYNC_HASHES.len() > 6642);
27    }
28}