From 5e308e3fee2cd33e9771aa1313b0bbff14f44bb0 Mon Sep 17 00:00:00 2001 From: Andronik Date: Thu, 13 Jan 2022 09:15:59 +0100 Subject: [PATCH] runtime-api: do not cache None SessionInfo (#4706) * approval-voting: add more logs * approval-voting: query finalized block on startup and increase look back * runtime-api: do not cache None SessionInfo --- polkadot/node/core/runtime-api/src/cache.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/polkadot/node/core/runtime-api/src/cache.rs b/polkadot/node/core/runtime-api/src/cache.rs index 72206da8a1..d2582a26ad 100644 --- a/polkadot/node/core/runtime-api/src/cache.rs +++ b/polkadot/node/core/runtime-api/src/cache.rs @@ -317,7 +317,10 @@ impl RequestResultCache { } pub(crate) fn cache_session_info(&mut self, key: SessionIndex, value: Option) { - self.session_info.insert(key, ResidentSizeOf(value)); + // only cache Some(SessionInfo) + if value.is_some() { + self.session_info.insert(key, ResidentSizeOf(value)); + } } pub(crate) fn dmq_contents(