Dynamically generate CHT roots on a full client (#6944)

* Generate CHT roots on a full client

* add changes_trie_root function

* Add a test

* Line widths

* Fix sc-service-test

* Clarify comments

* Revert comments
This commit is contained in:
Ashley
2020-08-24 15:11:21 +02:00
committed by GitHub
parent f009f6c227
commit c8ca2ce183
8 changed files with 139 additions and 56 deletions
+18
View File
@@ -536,3 +536,21 @@ pub fn changes_tries_state_at_block<'a, Block: BlockT>(
None => Ok(None),
}
}
/// Provide CHT roots. These are stored on a light client and generated dynamically on a full
/// client.
pub trait ProvideChtRoots<Block: BlockT> {
/// Get headers CHT root for given block. Returns None if the block is not a part of any CHT.
fn header_cht_root(
&self,
cht_size: NumberFor<Block>,
block: NumberFor<Block>,
) -> sp_blockchain::Result<Option<Block::Hash>>;
/// Get changes trie CHT root for given block. Returns None if the block is not a part of any CHT.
fn changes_trie_cht_root(
&self,
cht_size: NumberFor<Block>,
block: NumberFor<Block>,
) -> sp_blockchain::Result<Option<Block::Hash>>;
}