Remove on_block_imported (#6039)

* remove on_block_imported

* Update client/network/src/service.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Arkadiy Paronyan
2020-05-16 12:59:34 +02:00
committed by GitHub
parent d7463d348f
commit cdb7808a0e
5 changed files with 31 additions and 29 deletions
+8 -6
View File
@@ -400,16 +400,18 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
&self.service
}
/// You must call this when a new block is imported by the client.
pub fn on_block_imported(&mut self, header: B::Header, is_best: bool) {
self.network_service.user_protocol_mut().on_block_imported(&header, is_best);
}
/// You must call this when a new block is finalized by the client.
pub fn on_block_finalized(&mut self, hash: B::Hash, header: B::Header) {
self.network_service.user_protocol_mut().on_block_finalized(hash, &header);
}
/// This should be called when blocks are added to the
/// chain by something other than the import queue.
/// Currently this is only useful for tests.
pub fn update_chain(&mut self) {
self.network_service.user_protocol_mut().update_chain();
}
/// Returns the local `PeerId`.
pub fn local_peer_id(&self) -> &PeerId {
Swarm::<B, H>::local_peer_id(&self.network_service)
@@ -1349,7 +1351,7 @@ impl<'a, B: BlockT, H: ExHashT> Link<B> for NetworkLink<'a, B, H> {
count: usize,
results: Vec<(Result<BlockImportResult<NumberFor<B>>, BlockImportError>, B::Hash)>
) {
self.protocol.user_protocol_mut().blocks_processed(imported, count, results)
self.protocol.user_protocol_mut().on_blocks_processed(imported, count, results)
}
fn justification_imported(&mut self, who: PeerId, hash: &B::Hash, number: NumberFor<B>, success: bool) {
self.protocol.user_protocol_mut().justification_import_result(hash.clone(), number, success);