conditional style fix

This commit is contained in:
Robert Habermeier 2016-06-03 12:15:27 +02:00
parent 6f850ebdac
commit aa465fa2cd

View File

@ -379,12 +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();
let root = HeaderView::new(&header).state_root();
// check that the block is not too old -- blocks within `HISTORY` blocks of the best will // check that the block is not too old -- blocks within `HISTORY` blocks of the best will
// always be available. If the block could be too old, check if its state root is valid. // always be available. If the block could be too old, check if its state root is valid.
if db.is_pruned() let root = HeaderView::new(&header).state_root();
&& self.chain.best_block_number() >= block_number + HISTORY let is_old = self.chain.best_block_number() >= block_number + HISTORY;
&& !db.contains(&root) { if db.is_pruned() && is_old && !db.contains(&root) {
return None; return None;
} }