mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
feat: generalize some functions in sp-trie (#12376)
* feat: add to_memory_db to StorageProof * feat: add iter method and generalize iter_nodes * fmt * feat: generalize `encode_compact` like `decode_compact`, add to_compact_proof to StorageProof * fix to_compact_proof * improve by suggestions * improve by suggestions Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -346,7 +346,7 @@ where
|
||||
.and_then(|block| {
|
||||
self.client
|
||||
.read_proof(&block, &mut keys.iter().map(|key| key.0.as_ref()))
|
||||
.map(|proof| proof.iter_nodes().map(|node| node.into()).collect())
|
||||
.map(|proof| proof.into_iter_nodes().map(|node| node.into()).collect())
|
||||
.map(|proof| ReadProof { at: block, proof })
|
||||
})
|
||||
.map_err(client_err)
|
||||
@@ -498,7 +498,7 @@ where
|
||||
&child_info,
|
||||
&mut keys.iter().map(|key| key.0.as_ref()),
|
||||
)
|
||||
.map(|proof| proof.iter_nodes().map(|node| node.into()).collect())
|
||||
.map(|proof| proof.into_iter_nodes().map(|node| node.into()).collect())
|
||||
.map(|proof| ReadProof { at: block, proof })
|
||||
})
|
||||
.map_err(client_err)
|
||||
|
||||
@@ -1190,8 +1190,8 @@ where
|
||||
let (proof, count) = prove_range_read_with_child_with_size::<_, HashFor<Block>>(
|
||||
state, size_limit, start_key,
|
||||
)?;
|
||||
// This is read proof only, we can use either LayoutV0 or LayoutV1.
|
||||
let proof = sp_trie::encode_compact::<sp_trie::LayoutV0<HashFor<Block>>>(proof, root)
|
||||
let proof = proof
|
||||
.into_compact_proof::<HashFor<Block>>(root)
|
||||
.map_err(|e| sp_blockchain::Error::from_state(Box::new(e)))?;
|
||||
Ok((proof, count))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user