Sync reorg up to history size (#3874)
* Allow sync reorg up to pruning history size * Peer difficulty tracking * Abort downloading block if received with NewBlock * Set pruning history to 1200 * Renamed history size field
This commit is contained in:
committed by
Gav Wood
parent
4516f893e5
commit
5a3c3bcb45
@@ -1205,7 +1205,7 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn import_block(&self, bytes: Bytes) -> Result<H256, BlockImportError> {
|
||||
use verification::queue::kind::HasHash;
|
||||
use verification::queue::kind::BlockLike;
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
|
||||
// create unverified block here so the `sha3` calculation can be cached.
|
||||
@@ -1245,7 +1245,9 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn chain_info(&self) -> BlockChainInfo {
|
||||
self.chain.read().chain_info()
|
||||
let mut chain_info = self.chain.read().chain_info();
|
||||
chain_info.pending_total_difficulty = chain_info.total_difficulty + self.block_queue.total_difficulty();
|
||||
chain_info
|
||||
}
|
||||
|
||||
fn additional_params(&self) -> BTreeMap<String, String> {
|
||||
@@ -1369,6 +1371,7 @@ impl BlockChainClient for Client {
|
||||
PruningInfo {
|
||||
earliest_chain: self.chain.read().first_block_number().unwrap_or(1),
|
||||
earliest_state: self.state_db.lock().journal_db().earliest_era().unwrap_or(0),
|
||||
state_history_size: Some(self.history),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user