use pruning history in CLI snapshots

This commit is contained in:
Robert Habermeier 2016-10-17 13:05:57 +02:00
parent 8263bd4be2
commit c2dd37bb69

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)) {