reset cache when storage possibly change (fix init of tests). (#9665)

* reset cache when storage possibly change (fix init of tests).

* remove backend_storage_mut

* fix warn

* remove remaining backend_storage_mut
This commit is contained in:
cheme authored and GitHub committed 2021-09-06 10:42:02 +00:00
1 parent d99c0cead7
commit 61941f2806
4 files changed
+7 -15

No files matched your search

@@ -74,8 +74,9 @@ where
/// Apply the given transaction to this backend and set the root to the given value.
pub fn apply_transaction(&mut self, root: H::Out, transaction: MemoryDB<H>) {
self.backend_storage_mut().consolidate(transaction);
self.essence.set_root(root);
let mut storage = sp_std::mem::take(self).into_storage();
storage.consolidate(transaction);
*self = TrieBackend::new(storage, root);
}
/// Compare with another in-memory backend.