Merge pull request #2658 from ethcore/snapshot-earliest-era

use pruning history in CLI snapshots
This commit is contained in:
Robert Habermeier 2016-10-18 13:57:43 +02:00 committed by GitHub
commit 0eb8cb453b

View File

@ -625,12 +625,13 @@ impl Client {
return Err(snapshot::Error::OldBlockPrunedDB.into()); return Err(snapshot::Error::OldBlockPrunedDB.into());
} }
let history = ::std::cmp::min(self.history, 1000);
let start_hash = match at { let start_hash = match at {
BlockID::Latest => { BlockID::Latest => {
let start_num = if best_block_number > 1000 { let start_num = match db.earliest_era() {
best_block_number - 1000 Some(era) => ::std::cmp::max(era, best_block_number - history),
} else { None => best_block_number - history,
0
}; };
match self.block_hash(BlockID::Number(start_num)) { match self.block_hash(BlockID::Number(start_num)) {