Memory-based pruning history size (#4114)

* prune states based on memory param

* pruning memory CLI and usage in sync

* return purged value from memorydb

* calculate memory used incrementally in overlayrecentdb

* refactor shared history pruning code in client

* Fixed usage alignment

* journal_size function for fast memory calculation
This commit is contained in:
Robert Habermeier
2017-01-20 13:25:53 +01:00
committed by Gav Wood
parent 97a60ceab1
commit 203fd8a471
17 changed files with 220 additions and 53 deletions

View File

@@ -714,10 +714,10 @@ impl BlockChainClient for TestBlockChainClient {
fn disable(&self) { unimplemented!(); }
fn pruning_info(&self) -> PruningInfo {
let best_num = self.chain_info().best_block_number;
PruningInfo {
earliest_chain: 1,
earliest_state: 1,
state_history_size: *self.history.read(),
earliest_state: self.history.read().as_ref().map(|x| best_num - x).unwrap_or(0),
}
}