mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 22:51:13 +00:00
Fix the storage_size/state_getStorageSize RPC call (#13154)
* Have `KeyIterator` clone the `prefix` it receives * Stream keys in `storage_size` RPC and add a runtime limit * Update client/rpc/Cargo.toml Co-authored-by: Bastian Köcher <git@kchr.de> * Update client/rpc/src/state/utils.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Rename the types to signify that the cancellation is due to a timeout * Move the test into a `mod tests` * Add a comment regarding `biased` in `tokio::select` * Make the `clone` explicit when calling `KeyIterator::{new, new_child}` Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -1432,27 +1432,27 @@ where
|
||||
Ok(keys)
|
||||
}
|
||||
|
||||
fn storage_keys_iter<'a>(
|
||||
fn storage_keys_iter(
|
||||
&self,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
prefix: Option<&'a StorageKey>,
|
||||
prefix: Option<&StorageKey>,
|
||||
start_key: Option<&StorageKey>,
|
||||
) -> sp_blockchain::Result<KeyIterator<'a, B::State, Block>> {
|
||||
) -> sp_blockchain::Result<KeyIterator<B::State, Block>> {
|
||||
let state = self.state_at(hash)?;
|
||||
let start_key = start_key.or(prefix).map(|key| key.0.clone()).unwrap_or_else(Vec::new);
|
||||
Ok(KeyIterator::new(state, prefix, start_key))
|
||||
Ok(KeyIterator::new(state, prefix.cloned(), start_key))
|
||||
}
|
||||
|
||||
fn child_storage_keys_iter<'a>(
|
||||
fn child_storage_keys_iter(
|
||||
&self,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
child_info: ChildInfo,
|
||||
prefix: Option<&'a StorageKey>,
|
||||
prefix: Option<&StorageKey>,
|
||||
start_key: Option<&StorageKey>,
|
||||
) -> sp_blockchain::Result<KeyIterator<'a, B::State, Block>> {
|
||||
) -> sp_blockchain::Result<KeyIterator<B::State, Block>> {
|
||||
let state = self.state_at(hash)?;
|
||||
let start_key = start_key.or(prefix).map(|key| key.0.clone()).unwrap_or_else(Vec::new);
|
||||
Ok(KeyIterator::new_child(state, child_info, prefix, start_key))
|
||||
Ok(KeyIterator::new_child(state, child_info, prefix.cloned(), start_key))
|
||||
}
|
||||
|
||||
fn storage(
|
||||
|
||||
Reference in New Issue
Block a user