mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Add a LightSyncState field to the chain spec (#6894)
* Reset code, almost ready for PR * Improved build_hardcoded_spec * Fix line widths * Fix tests * Fix sc-service-test * Suggestions from code review * Rename to LightSyncState * It's not syncing :^( * It syncs! * Remove rpc call * Convert spaces to tabs * Moved sc-service things to export_sync_state.rs * Fix tests * Wait for syncing with network_status_sinks * Remove sc-network from node-template * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Various changes, split the flag up into 2 pieces to make testing easier. * Update client/cli/src/commands/build_spec_cmd.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Revert a lot of changes Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -27,7 +27,7 @@ use sc_client_api::{
|
||||
blockchain::{
|
||||
BlockStatus, Cache as BlockchainCache, Info as BlockchainInfo,
|
||||
},
|
||||
Storage
|
||||
Storage, ChtRootStorage,
|
||||
};
|
||||
use sp_blockchain::{
|
||||
CachedHeaderMetadata, HeaderMetadata, HeaderMetadataCache,
|
||||
@@ -523,22 +523,6 @@ impl<Block> Storage<Block> for LightStorage<Block>
|
||||
}
|
||||
}
|
||||
|
||||
fn header_cht_root(
|
||||
&self,
|
||||
cht_size: NumberFor<Block>,
|
||||
block: NumberFor<Block>,
|
||||
) -> ClientResult<Option<Block::Hash>> {
|
||||
self.read_cht_root(HEADER_CHT_PREFIX, cht_size, block)
|
||||
}
|
||||
|
||||
fn changes_trie_cht_root(
|
||||
&self,
|
||||
cht_size: NumberFor<Block>,
|
||||
block: NumberFor<Block>,
|
||||
) -> ClientResult<Option<Block::Hash>> {
|
||||
self.read_cht_root(CHANGES_TRIE_CHT_PREFIX, cht_size, block)
|
||||
}
|
||||
|
||||
fn finalize_header(&self, id: BlockId<Block>) -> ClientResult<()> {
|
||||
if let Some(header) = self.header(id)? {
|
||||
let mut transaction = Transaction::new();
|
||||
@@ -612,6 +596,26 @@ impl<Block> Storage<Block> for LightStorage<Block>
|
||||
}
|
||||
}
|
||||
|
||||
impl<Block> ChtRootStorage<Block> for LightStorage<Block>
|
||||
where Block: BlockT,
|
||||
{
|
||||
fn header_cht_root(
|
||||
&self,
|
||||
cht_size: NumberFor<Block>,
|
||||
block: NumberFor<Block>,
|
||||
) -> ClientResult<Option<Block::Hash>> {
|
||||
self.read_cht_root(HEADER_CHT_PREFIX, cht_size, block)
|
||||
}
|
||||
|
||||
fn changes_trie_cht_root(
|
||||
&self,
|
||||
cht_size: NumberFor<Block>,
|
||||
block: NumberFor<Block>,
|
||||
) -> ClientResult<Option<Block::Hash>> {
|
||||
self.read_cht_root(CHANGES_TRIE_CHT_PREFIX, cht_size, block)
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the key for inserting header-CHT at given block.
|
||||
fn cht_key<N: TryInto<u32>>(cht_type: u8, block: N) -> ClientResult<[u8; 5]> {
|
||||
let mut key = [cht_type; 5];
|
||||
|
||||
Reference in New Issue
Block a user