Don't call mark_as_bad needlessly

This commit is contained in:
arkpar
2016-03-10 00:21:07 +01:00
parent 02b23d3deb
commit 84a741d0f9
2 changed files with 12 additions and 2 deletions

View File

@@ -320,6 +320,9 @@ impl BlockQueue {
/// Mark given block and all its children as bad. Stops verification.
pub fn mark_as_bad(&mut self, block_hashes: &[H256]) {
if block_hashes.is_empty() {
return;
}
let mut verification_lock = self.verification.lock().unwrap();
let mut processing = self.processing.write().unwrap();
@@ -345,6 +348,9 @@ impl BlockQueue {
/// Mark given block as processed
pub fn mark_as_good(&mut self, block_hashes: &[H256]) {
if block_hashes.is_empty() {
return;
}
let mut processing = self.processing.write().unwrap();
for hash in block_hashes {
processing.remove(&hash);