Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
merge with master
  • Loading branch information
seunlanlege committed Mar 5, 2020
commit 2dc641cf0e1bc4b0ad8fecfb54a18e6cd1d14523
2 changes: 1 addition & 1 deletion client/api/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl <'a, State, Block> KeyIterator<'a, State, Block> {

impl<'a, State, Block> Iterator for KeyIterator<'a, State, Block> where
Block: BlockT,
State: StateBackend<HasherFor<Block>>,
State: StateBackend<HashFor<Block>>,
{
type Item = StorageKey;

Expand Down
2 changes: 1 addition & 1 deletion client/finality-grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use sp_consensus::{
use std::{
collections::{HashMap, HashSet},
result,
pin::Pin, task,
pin::Pin,
};
use parity_scale_codec::Decode;
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, HashFor};
Expand Down
2 changes: 1 addition & 1 deletion client/rpc/src/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ trait ChainBackend<Client, Block: BlockT>: Send + Sync + 'static
self.client(),
self.subscriptions(),
subscriber,
|| self.client().chain_info().best_hash,
|| self.client().info().best_hash,
|| self.client().import_notification_stream()
.map(|notification| Ok::<_, ()>(notification.header))
.compat(),
Expand Down
42 changes: 1 addition & 41 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,46 +102,6 @@ pub struct Client<B, E, Block, RA> where Block: BlockT {
_phantom: PhantomData<RA>,
}

/// An `Iterator` that iterates keys in a given block under a prefix.
pub struct KeyIterator<'a, State, Block> {
state: State,
prefix: Option<&'a StorageKey>,
current_key: Vec<u8>,
_phantom: PhantomData<Block>,
}

impl <'a, State, Block> KeyIterator<'a, State, Block> {
fn new(state: State, prefix: Option<&'a StorageKey>, current_key: Vec<u8>) -> Self {
Self {
state,
prefix,
current_key,
_phantom: PhantomData,
}
}
}

impl<'a, State, Block> Iterator for KeyIterator<'a, State, Block> where
Block: BlockT,
State: StateBackend<HashFor<Block>>,
{
type Item = StorageKey;

fn next(&mut self) -> Option<Self::Item> {
let next_key = self.state
.next_storage_key(&self.current_key)
.ok()
.flatten()?;
if let Some(prefix) = self.prefix {
if !next_key.starts_with(&prefix.0[..]) {
return None;
}
}
self.current_key = next_key.clone();
Some(StorageKey(next_key))
}
}

// used in importing a block, where additional changes are made after the runtime
// executed.
enum PrePostHeader<H> {
Expand Down Expand Up @@ -1391,7 +1351,7 @@ impl<B, E, Block, RA> StorageProvider<Block, B> for Client<B, E, Block, RA> wher
zero: config_zero.clone(),
end: config_end.map(|(config_end_number, _)| config_end_number),
};
let result_range: Vec<(NumberFor<Block>, u32)> = key_changes::<HasherFor<Block>, _>(
let result_range: Vec<(NumberFor<Block>, u32)> = key_changes::<HashFor<Block>, _>(
config_range,
storage.storage(),
range_first,
Expand Down