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
2021-09-06 12:42:02 +02:00
committed by GitHub
parent d99c0cead7
commit 61941f2806
4 changed files with 7 additions and 15 deletions
@@ -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.