Move status cache serialization to the Snapshot Packager service (#6081)

* Move status cache serialization to the Snapshot Packager service

* Minor comment updates

* use ok_or_else instead of ok_or

* satus cache

* Remove assert when snapshot format is wrong

* Fix compile

* Remove slots_to_snapshot from bank forks

* Address review comment

* Remove unused imports
This commit is contained in:
Sagar Dhawan
2019-09-25 13:42:19 -07:00
committed by GitHub
parent 093b5b5267
commit e987d0094f
8 changed files with 159 additions and 129 deletions

View File

@@ -1,13 +1,13 @@
use log::*;
use rand::{thread_rng, Rng};
use serde::Serialize;
use solana_sdk::clock::{Slot, MAX_HASH_AGE_IN_SECONDS};
use solana_sdk::clock::{Slot, MAX_RECENT_BLOCKHASHES};
use solana_sdk::hash::Hash;
use solana_sdk::signature::Signature;
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, Mutex};
pub const MAX_CACHE_ENTRIES: usize = MAX_HASH_AGE_IN_SECONDS;
pub const MAX_CACHE_ENTRIES: usize = MAX_RECENT_BLOCKHASHES;
const CACHED_SIGNATURE_SIZE: usize = 20;
// Store forks in a single chunk of memory to avoid another lookup.
@@ -430,4 +430,9 @@ mod tests {
assert_eq!(cache, status_cache);
}
#[test]
fn test_age_sanity() {
assert!(MAX_CACHE_ENTRIES <= MAX_RECENT_BLOCKHASHES);
}
}