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 authored and Bastian Köcher committed 2024-04-10 10:28:37 +02:00
1 parent c00a47d5ca
commit 658e4e9b5c
5 files changed
+64 -32

No files matched your search

+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.