Inform sync explicitly about new best block (#7604)

* Inform sync explicitly about new best block

Instead of "fishing" the new best block out of the processed blocks, we
now tell sync directly that there is a new best block. It also makes
sure that we update the corresponding sync handshake to the new best
block. This is required for parachains as they first import blocks and
declare the new best block after being made aware of it by the relay chain.

* Adds test

* Make sure async stuff had time to run
This commit is contained in:
Bastian Köcher
2020-11-26 17:33:17 +01:00
committed by GitHub
parent 769f1981cb
commit d698d01378
7 changed files with 84 additions and 55 deletions
@@ -136,7 +136,7 @@ pub trait Link<B: BlockT>: Send {
/// Block import successful result.
#[derive(Debug, PartialEq)]
pub enum BlockImportResult<N: ::std::fmt::Debug + PartialEq> {
pub enum BlockImportResult<N: std::fmt::Debug + PartialEq> {
/// Imported known block.
ImportedKnown(N),
/// Imported unknown block.