add early exit for pruned blocks
This commit is contained in:
parent
e6921144dc
commit
3dff5a9f3f
@ -379,6 +379,11 @@ impl<V> Client<V> where V: Verifier {
|
|||||||
self.block_header(id).and_then(|header| {
|
self.block_header(id).and_then(|header| {
|
||||||
let db = self.state_db.lock().unwrap().boxed_clone();
|
let db = self.state_db.lock().unwrap().boxed_clone();
|
||||||
|
|
||||||
|
// early exit for pruned blocks
|
||||||
|
if db.is_pruned() && self.chain.best_block_number() >= block_number + HISTORY {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO [rob]: refactor State::from_existing so we avoid doing redundant lookups.
|
// TODO [rob]: refactor State::from_existing so we avoid doing redundant lookups.
|
||||||
if !db.contains(&root) {
|
if !db.contains(&root) {
|
||||||
return None;
|
return None;
|
||||||
|
Loading…
Reference in New Issue
Block a user