Prevent sync restart if import queue full (#9381)

This commit is contained in:
Andrew Jones
2018-08-24 09:42:24 +01:00
committed by GitHub
parent 31291ebd35
commit 0b34579b04
3 changed files with 35 additions and 26 deletions

View File

@@ -25,7 +25,7 @@ use ethereum_types::H256;
use rlp::{self, Rlp};
use ethcore::header::BlockNumber;
use ethcore::client::{BlockStatus, BlockId, BlockImportError, BlockImportErrorKind};
use ethcore::error::{ImportErrorKind, BlockError};
use ethcore::error::{ImportErrorKind, QueueErrorKind, BlockError};
use sync_io::SyncIo;
use blocks::{BlockCollection, SyncBody, SyncHeader};
@@ -513,6 +513,10 @@ impl BlockDownloader {
debug!(target: "sync", "Block temporarily invalid, restarting sync");
break;
},
Err(BlockImportError(BlockImportErrorKind::Queue(QueueErrorKind::Full(limit)), _)) => {
debug!(target: "sync", "Block import queue full ({}), restarting sync", limit);
break;
},
Err(e) => {
debug!(target: "sync", "Bad block {:?} : {:?}", h, e);
bad = true;