Don't sync on top of pruned blocks (#2079)

* Don't sync to pruned blocks

* Typo

Co-Authored-By: arkpar <arkady.paronyan@gmail.com>
This commit is contained in:
Arkadiy Paronyan
2019-03-22 16:27:50 +01:00
committed by GitHub
parent 53f40c583d
commit 704d2a49c7
5 changed files with 59 additions and 21 deletions
+4
View File
@@ -142,6 +142,10 @@ pub trait Backend<Block, H>: AuxStore + Send + Sync where
fn blockchain(&self) -> &Self::Blockchain;
/// Returns reference to changes trie storage.
fn changes_trie_storage(&self) -> Option<&Self::ChangesTrieStorage>;
/// Returns true if state for given block is available.
fn have_state_at(&self, hash: &Block::Hash, _number: NumberFor<Block>) -> bool {
self.state_at(BlockId::Hash(hash.clone())).is_ok()
}
/// Returns state backend with post-state of given block.
fn state_at(&self, block: BlockId<Block>) -> error::Result<Self::State>;
/// Destroy state and save any useful data, such as cache.