[beta] Backports (#8450)

* Use forked app_dirs crate for reverted Windows dir behavior  (#8438)

* Remove unused appdirs dependency in CLI

* Use forked app_dirs crate for reverted Windows dir behavior

* remove Tendermint extra_info due to seal inconsistencies (#8367)

* handle queue import errors a bit more gracefully (#8385)

* Improve VM executor stack size estimation rules (#8439)

* Improve VM executor stack size estimation rules

* typo: docs add "(Debug build)" comment

* Fix an off by one typo and set minimal stack size

This avoids the case if `depth_threshold == max_depth`. Usually setting stack size to zero will just rebound it to
platform minimal stack size, but we set it here just in case.

* Use saturating_sub to avoid potential overflow
This commit is contained in:
Wei Tang
2018-04-20 21:22:29 +08:00
committed by Afri Schoedon
parent 45c29a2a57
commit 7202f7ae82
7 changed files with 41 additions and 35 deletions

View File

@@ -427,6 +427,8 @@ impl<L: AsLightClient> LightSync<L> {
// handles request dispatch, block import, state machine transitions, and timeouts.
fn maintain_sync(&self, ctx: &BasicContext) {
use ethcore::error::{BlockImportError, ImportError};
const DRAIN_AMOUNT: usize = 128;
let client = self.client.as_light_client();
@@ -453,11 +455,20 @@ impl<L: AsLightClient> LightSync<L> {
trace!(target: "sync", "Drained {} headers to import", sink.len());
for header in sink.drain(..) {
if let Err(e) = client.queue_header(header) {
debug!(target: "sync", "Found bad header ({:?}). Reset to search state.", e);
match client.queue_header(header) {
Ok(_) => {}
Err(BlockImportError::Import(ImportError::AlreadyInChain)) => {
trace!(target: "sync", "Block already in chain. Continuing.");
},
Err(BlockImportError::Import(ImportError::AlreadyQueued)) => {
trace!(target: "sync", "Block already queued. Continuing.");
},
Err(e) => {
debug!(target: "sync", "Found bad header ({:?}). Reset to search state.", e);
self.begin_search(&mut state);
break 'a;
self.begin_search(&mut state);
break 'a;
}
}
}
}