Use No-Op Ancestry Checker (#755)

* Use no-op ancestry checker

* Check that current header height is greater than last finalized

* Ensure that incoming headers are strictly greater than last finalized

* Ensure that header numbers always increase in tests
This commit is contained in:
Hernando Castano
2021-02-26 12:57:06 -05:00
committed by Bastian Köcher
parent c00a47d5ca
commit 658e4e9b5c
5 changed files with 64 additions and 32 deletions
+4 -2
View File
@@ -78,7 +78,7 @@ pub trait HeaderChain<H, E> {
fn authority_set() -> AuthoritySet;
/// Write a header finalized by GRANDPA to the underlying pallet storage.
fn append_header(header: H);
fn append_header(header: H) -> Result<(), E>;
}
impl<H: Default, E> HeaderChain<H, E> for () {
@@ -90,7 +90,9 @@ impl<H: Default, E> HeaderChain<H, E> for () {
AuthoritySet::default()
}
fn append_header(_header: H) {}
fn append_header(_header: H) -> Result<(), E> {
Ok(())
}
}
/// A trait for checking if a given child header is a direct descendant of an ancestor.