perf(ethcore): micro-opt (#10405)

Mostly fixes that changes `eagerly eval` to `lazy eval`
This commit is contained in:
Niklas Adolfsson
2019-03-06 15:30:35 +01:00
committed by Marek Kotewicz
parent 3e1d73126c
commit 91933d857d
15 changed files with 39 additions and 35 deletions

View File

@@ -1149,7 +1149,7 @@ impl Client {
pub fn take_snapshot<W: snapshot_io::SnapshotWriter + Send>(&self, writer: W, at: BlockId, p: &snapshot::Progress) -> Result<(), EthcoreError> {
let db = self.state_db.read().journal_db().boxed_clone();
let best_block_number = self.chain_info().best_block_number;
let block_number = self.block_number(at).ok_or(snapshot::Error::InvalidStartingBlock(at))?;
let block_number = self.block_number(at).ok_or_else(|| snapshot::Error::InvalidStartingBlock(at))?;
if db.is_pruned() && self.pruning_info().earliest_state > block_number {
return Err(snapshot::Error::OldBlockPrunedDB.into());