Merge branch 'master' of github.com:ethcore/parity into import_route
This commit is contained in:
commit
190a2c3b35
@ -320,6 +320,9 @@ 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, block_hashes: &[H256]) {
|
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 verification_lock = self.verification.lock().unwrap();
|
||||||
let mut processing = self.processing.write().unwrap();
|
let mut processing = self.processing.write().unwrap();
|
||||||
|
|
||||||
@ -345,6 +348,9 @@ impl BlockQueue {
|
|||||||
|
|
||||||
/// Mark given block as processed
|
/// Mark given block as processed
|
||||||
pub fn mark_as_good(&mut self, block_hashes: &[H256]) {
|
pub fn mark_as_good(&mut self, block_hashes: &[H256]) {
|
||||||
|
if block_hashes.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let mut processing = self.processing.write().unwrap();
|
let mut processing = self.processing.write().unwrap();
|
||||||
for hash in block_hashes {
|
for hash in block_hashes {
|
||||||
processing.remove(&hash);
|
processing.remove(&hash);
|
||||||
|
@ -409,8 +409,12 @@ impl<V> Client<V> where V: Verifier {
|
|||||||
|
|
||||||
{
|
{
|
||||||
let mut block_queue = self.block_queue.write().unwrap();
|
let mut block_queue = self.block_queue.write().unwrap();
|
||||||
block_queue.mark_as_bad(&bad_blocks);
|
if !bad_blocks.is_empty() {
|
||||||
block_queue.mark_as_good(&good_blocks);
|
block_queue.mark_as_bad(&bad_blocks);
|
||||||
|
}
|
||||||
|
if !good_blocks.is_empty() {
|
||||||
|
block_queue.mark_as_good(&good_blocks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user