Drop the block cache after genesis

This commit is contained in:
Paul Hauner
2019-11-25 18:19:55 +11:00
parent ebfa1f53d6
commit aebf7d38e0
2 changed files with 16 additions and 0 deletions

View File

@@ -163,6 +163,11 @@ impl Service {
&self.inner.deposit_cache
}
/// Drop the block cache, replacing it with an empty one.
pub fn drop_block_cache(&self) {
*(self.inner.block_cache.write()) = BlockCache::default();
}
/// Returns the number of currently cached blocks.
pub fn block_cache_len(&self) -> usize {
self.blocks().read().len()