Skip to content
Snippets Groups Projects
Commit c744374f authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Directly use the new `to_memory_db` function (#1080)

This reduces the amount of code a little bit.
parent 889c34d8
No related merge requests found
......@@ -66,19 +66,15 @@ where
let block = B::new(header, extrinsics);
assert!(parent_head.hash() == *block.header().parent_hash(), "Invalid parent hash",);
// Uncompress
let mut db = MemoryDB::default();
let root = match sp_trie::decode_compact::<sp_trie::LayoutV1<HashFor<B>>, _, _>(
&mut db,
storage_proof.iter_compact_encoded_nodes(),
Some(parent_head.state_root()),
) {
Ok(root) => root,
// Create the db
let (db, root) = match storage_proof.to_memory_db(Some(parent_head.state_root())) {
Ok((db, root)) => (db, root),
Err(_) => panic!("Compact proof decoding failure."),
};
sp_std::mem::drop(storage_proof);
let backend = sp_state_machine::TrieBackend::new(db, root);
let backend = sp_state_machine::TrieBackend::new(db, *parent_head.state_root());
let _guard = (
// Replace storage calls with our own implementations
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment