Make trie-cache resettable from backend (#14516)

* Add ability to reset trie-cache

* comment

* Update client/db/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Sebastian Kunert
2023-07-18 17:05:40 +02:00
committed by GitHub
parent 892831e55c
commit b6b1952fc6
+7
View File
@@ -1124,6 +1124,13 @@ impl<Block: BlockT> Backend<Block> {
Self::from_database(db as Arc<_>, canonicalization_delay, &db_config, needs_init)
}
/// Reset the shared trie cache.
pub fn reset_trie_cache(&self) {
if let Some(cache) = &self.shared_trie_cache {
cache.reset();
}
}
/// Create new memory-backed client backend for tests.
#[cfg(any(test, feature = "test-helpers"))]
pub fn new_test(blocks_pruning: u32, canonicalization_delay: u64) -> Self {