sync test temp fix
This commit is contained in:
parent
99a63d0639
commit
ce7b5b03ad
@ -79,6 +79,8 @@ struct Verification {
|
|||||||
bad: HashSet<H256>,
|
bad: HashSet<H256>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAX_UNVERIFIED_QUEUE_SIZE: usize = 50000;
|
||||||
|
|
||||||
impl BlockQueue {
|
impl BlockQueue {
|
||||||
/// Creates a new queue instance.
|
/// Creates a new queue instance.
|
||||||
pub fn new(engine: Arc<Box<Engine>>, message_channel: IoChannel<NetSyncMessage>) -> BlockQueue {
|
pub fn new(engine: Arc<Box<Engine>>, message_channel: IoChannel<NetSyncMessage>) -> BlockQueue {
|
||||||
@ -290,7 +292,7 @@ impl BlockQueue {
|
|||||||
pub fn queue_info(&self) -> BlockQueueInfo {
|
pub fn queue_info(&self) -> BlockQueueInfo {
|
||||||
let verification = self.verification.lock().unwrap();
|
let verification = self.verification.lock().unwrap();
|
||||||
BlockQueueInfo {
|
BlockQueueInfo {
|
||||||
full: false,
|
full: verification.unverified.len() + verification.verifying.len() >= MAX_UNVERIFIED_QUEUE_SIZE,
|
||||||
verified_queue_size: verification.verified.len(),
|
verified_queue_size: verification.verified.len(),
|
||||||
unverified_queue_size: verification.unverified.len(),
|
unverified_queue_size: verification.unverified.len(),
|
||||||
verifying_queue_size: verification.verifying.len(),
|
verifying_queue_size: verification.verifying.len(),
|
||||||
|
@ -292,7 +292,7 @@ impl ChainSync {
|
|||||||
trace!(target: "sync", "Ignored unexpected block headers");
|
trace!(target: "sync", "Ignored unexpected block headers");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if self.state == SyncState::Waiting {
|
if io.chain().queue_info().full {
|
||||||
trace!(target: "sync", "Ignored block headers while waiting");
|
trace!(target: "sync", "Ignored block headers while waiting");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ impl ChainSync {
|
|||||||
trace!(target: "sync", "Ignored unexpected block bodies");
|
trace!(target: "sync", "Ignored unexpected block bodies");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if self.state == SyncState::Waiting {
|
if io.chain().queue_info().full {
|
||||||
trace!(target: "sync", "Ignored block bodies while waiting");
|
trace!(target: "sync", "Ignored block bodies while waiting");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@ -532,7 +532,7 @@ impl ChainSync {
|
|||||||
/// Enter waiting state
|
/// Enter waiting state
|
||||||
fn pause_sync(&mut self) {
|
fn pause_sync(&mut self) {
|
||||||
trace!(target: "sync", "Block queue full, pausing sync");
|
trace!(target: "sync", "Block queue full, pausing sync");
|
||||||
self.state = SyncState::Waiting;
|
//self.state = SyncState::Waiting;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find something to do for a peer. Called for a new peer or when a peer is done with it's task.
|
/// Find something to do for a peer. Called for a new peer or when a peer is done with it's task.
|
||||||
|
Loading…
Reference in New Issue
Block a user