Fixing mark_as_bad implementation
This commit is contained in:
parent
d914a27bdf
commit
08647282df
@ -1 +1 @@
|
|||||||
Subproject commit f32954b3ddb5af2dc3dc9ec6d9a28bee848fdf70
|
Subproject commit 3116f85a499ceaf4dfdc46726060fc056e2d7829
|
@ -287,22 +287,25 @@ impl BlockQueue {
|
|||||||
/// Mark given block and all its children as bad. Stops verification.
|
/// Mark given block and all its children as bad. Stops verification.
|
||||||
pub fn mark_as_bad(&mut self, hashes: &[H256]) {
|
pub fn mark_as_bad(&mut self, hashes: &[H256]) {
|
||||||
let mut verification_lock = self.verification.lock().unwrap();
|
let mut verification_lock = self.verification.lock().unwrap();
|
||||||
let mut verification = verification_lock.deref_mut();
|
let mut processing = self.processing.write().unwrap();
|
||||||
let mut new_verified = VecDeque::new();
|
|
||||||
|
|
||||||
|
let mut verification = verification_lock.deref_mut();
|
||||||
|
|
||||||
|
verification.bad.reserve(hashes.len());
|
||||||
for hash in hashes {
|
for hash in hashes {
|
||||||
verification.bad.insert(hash.clone());
|
verification.bad.insert(hash.clone());
|
||||||
self.processing.write().unwrap().remove(&hash);
|
processing.remove(&hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut new_verified = VecDeque::new();
|
||||||
for block in verification.verified.drain(..) {
|
for block in verification.verified.drain(..) {
|
||||||
if verification.bad.contains(&block.header.parent_hash) {
|
if verification.bad.contains(&block.header.parent_hash) {
|
||||||
verification.bad.insert(block.header.hash());
|
verification.bad.insert(block.header.hash());
|
||||||
self.processing.write().unwrap().remove(&block.header.hash());
|
processing.remove(&block.header.hash());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
new_verified.push_back(block);
|
new_verified.push_back(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
verification.verified = new_verified;
|
verification.verified = new_verified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user