From c2dd37bb691e107bd4e62348e96c472276a43493 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Mon, 17 Oct 2016 13:05:57 +0200 Subject: [PATCH] use pruning history in CLI snapshots --- ethcore/src/client/client.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index f5d10266f..277ba2db0 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -625,12 +625,13 @@ impl Client { return Err(snapshot::Error::OldBlockPrunedDB.into()); } + let history = ::std::cmp::min(self.history, 1000); + let start_hash = match at { BlockID::Latest => { - let start_num = if best_block_number > 1000 { - best_block_number - 1000 - } else { - 0 + let start_num = match db.earliest_era() { + Some(era) => ::std::cmp::max(era, best_block_number - history), + None => best_block_number - history, }; match self.block_hash(BlockID::Number(start_num)) {