From 987531ab19257e04e441af49a1d4fecd9778dfd7 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 13 Nov 2024 02:25:05 +0100 Subject: [PATCH] chore: use let some notation --- crates/node/core/src/utils.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/node/core/src/utils.rs b/crates/node/core/src/utils.rs index 7aeb14c4c0e9..e8c048f786f6 100644 --- a/crates/node/core/src/utils.rs +++ b/crates/node/core/src/utils.rs @@ -86,14 +86,12 @@ where { let (peer_id, response) = client.get_block_body(header.hash()).await?.split(); - if response.is_none() { + let Some(body) = response else { client.report_bad_message(peer_id); eyre::bail!("Invalid number of bodies received. Expected: 1. Received: 0") - } + }; - let body = response.unwrap(); let block = SealedBlock { header, body }; - consensus.validate_block_pre_execution(&block)?; Ok(block)