Even more snapshot validity checks (#2935)
* clarify "cancelled periodic snapshot" message * more rigorous checks for snapshot validity * verify ancient blocks on import * limit number of fed blocks * make it possible to feed snapshot service canonical hashes * fix failing test build * swap ethash DAG only when more recent
This commit is contained in:
committed by
Gav Wood
parent
29ab4ecac1
commit
2806f1d4c9
@@ -23,6 +23,7 @@ use super::helpers::*;
|
||||
pub struct TestSnapshotService {
|
||||
manifest: Option<ManifestData>,
|
||||
chunks: HashMap<H256, Bytes>,
|
||||
canon_hashes: Mutex<HashMap<u64, H256>>,
|
||||
|
||||
restoration_manifest: Mutex<Option<ManifestData>>,
|
||||
state_restoration_chunks: Mutex<HashMap<H256, Bytes>>,
|
||||
@@ -34,6 +35,7 @@ impl TestSnapshotService {
|
||||
TestSnapshotService {
|
||||
manifest: None,
|
||||
chunks: HashMap::new(),
|
||||
canon_hashes: Mutex::new(HashMap::new()),
|
||||
restoration_manifest: Mutex::new(None),
|
||||
state_restoration_chunks: Mutex::new(HashMap::new()),
|
||||
block_restoration_chunks: Mutex::new(HashMap::new()),
|
||||
@@ -57,6 +59,7 @@ impl TestSnapshotService {
|
||||
TestSnapshotService {
|
||||
manifest: Some(manifest),
|
||||
chunks: chunks,
|
||||
canon_hashes: Mutex::new(HashMap::new()),
|
||||
restoration_manifest: Mutex::new(None),
|
||||
state_restoration_chunks: Mutex::new(HashMap::new()),
|
||||
block_restoration_chunks: Mutex::new(HashMap::new()),
|
||||
@@ -110,6 +113,10 @@ impl SnapshotService for TestSnapshotService {
|
||||
self.block_restoration_chunks.lock().insert(hash, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
fn provide_canon_hashes(&self, hashes: &[(u64, H256)]) {
|
||||
self.canon_hashes.lock().extend(hashes.iter().cloned());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user