From b409837b70a65a448399464c7dd256bea331ac63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 23 Dec 2021 20:27:03 +0100 Subject: [PATCH] Fix checking for the `ParachainHost` runtime api (#4594) The function `has_api` checks that the api + version matches, which isn't true anymore after bumping the version. The fix is to just compare the runtime api version being at least `1`. --- polkadot/node/overseer/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/polkadot/node/overseer/src/lib.rs b/polkadot/node/overseer/src/lib.rs index 9321fad7a4..36ffe54240 100644 --- a/polkadot/node/overseer/src/lib.rs +++ b/polkadot/node/overseer/src/lib.rs @@ -130,7 +130,13 @@ where { fn head_supports_parachains(&self, head: &Hash) -> bool { let id = BlockId::Hash(*head); - self.runtime_api().has_api::>(&id).unwrap_or(false) + // Check that the `ParachainHost` runtime api is at least with version 1 present on chain. + self.runtime_api() + .api_version::>(&id) + .ok() + .flatten() + .unwrap_or(0) >= + 1 } }