From 15599d0024ab29c113bd1e90ba37281fdf1ce800 Mon Sep 17 00:00:00 2001 From: Andrea Giacobino Date: Thu, 19 Oct 2023 13:44:23 +0200 Subject: [PATCH] avoid panic in service (#2528) --- node/service/src/lib.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 092d908819..f398f66663 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -1249,11 +1249,7 @@ where _phantom: Default::default(), })), create_inherent_data_providers: move |block: H256, ()| { - let current_para_block = client_set_aside_for_cidp - .number(block) - .expect("Header lookup should succeed") - .expect("Header passed in as parent should be present in backend."); - + let maybe_current_para_block = client_set_aside_for_cidp.number(block); let downward_xcm_receiver = downward_xcm_receiver.clone(); let hrmp_xcm_receiver = hrmp_xcm_receiver.clone(); @@ -1261,6 +1257,9 @@ where async move { let time = sp_timestamp::InherentDataProvider::from_system_time(); + let current_para_block = maybe_current_para_block? + .ok_or(sp_blockchain::Error::UnknownBlock(block.to_string()))?; + let mocked_parachain = MockValidationDataInherentDataProvider { current_para_block, relay_offset: 1000,