mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
Improvements to the import queue (#3101)
* Remove block_imported * Move blocks results processing to sync * Remove methods from Link * Better errors * Allow cancelling the import queue * Restore the import trace * Fix network tests * Line widths * Use has_error instead * Minor style
This commit is contained in:
committed by
Gavin Wood
parent
7ae6556a02
commit
5bd806bd9b
@@ -21,8 +21,8 @@ use futures::prelude::*;
|
||||
use log::{info, warn};
|
||||
|
||||
use runtime_primitives::generic::{SignedBlock, BlockId};
|
||||
use runtime_primitives::traits::{SaturatedConversion, Zero, One, Block, Header};
|
||||
use consensus_common::import_queue::{ImportQueue, IncomingBlock, Link};
|
||||
use runtime_primitives::traits::{SaturatedConversion, Zero, One, Block, Header, NumberFor};
|
||||
use consensus_common::import_queue::{ImportQueue, IncomingBlock, Link, BlockImportError, BlockImportResult};
|
||||
use network::message;
|
||||
|
||||
use consensus_common::BlockOrigin;
|
||||
@@ -111,10 +111,15 @@ impl WaitLink {
|
||||
}
|
||||
|
||||
impl<B: Block> Link<B> for WaitLink {
|
||||
fn blocks_processed(&mut self, processed_blocks: Vec<B::Hash>, has_error: bool) {
|
||||
self.imported_blocks += processed_blocks.len() as u64;
|
||||
if has_error {
|
||||
warn!("There was an error importing {} blocks", processed_blocks.len());
|
||||
fn blocks_processed(
|
||||
&mut self,
|
||||
imported: usize,
|
||||
count: usize,
|
||||
results: Vec<(Result<BlockImportResult<NumberFor<B>>, BlockImportError>, B::Hash)>
|
||||
) {
|
||||
self.imported_blocks += imported as u64;
|
||||
if results.iter().any(|(r, _)| r.is_err()) {
|
||||
warn!("There was an error importing {} blocks", count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user