From 80af7fa32a37f51718f7f15113dce3f7d708dd41 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Tue, 20 Sep 2022 11:29:43 +0400 Subject: [PATCH] fix(base-node/grpc): fixes panic if invalid kernel mr is given (#4693) Description --- Fixes panic if invalid kernel mr is given via grpc Motivation and Context --- Panic can be triggered by user-controller input How Has This Been Tested? --- Not tested --- applications/tari_app_grpc/src/conversions/block_header.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/tari_app_grpc/src/conversions/block_header.rs b/applications/tari_app_grpc/src/conversions/block_header.rs index f1a72173b1..c921ebe53b 100644 --- a/applications/tari_app_grpc/src/conversions/block_header.rs +++ b/applications/tari_app_grpc/src/conversions/block_header.rs @@ -85,7 +85,7 @@ impl TryFrom for BlockHeader { output_mr: FixedHash::try_from(header.output_mr).map_err(|err| err.to_string())?, witness_mr: FixedHash::try_from(header.witness_mr).map_err(|err| err.to_string())?, output_mmr_size: header.output_mmr_size, - kernel_mr: FixedHash::try_from(header.kernel_mr).expect("Array size 32 cannot fail"), + kernel_mr: FixedHash::try_from(header.kernel_mr).map_err(|err| err.to_string())?, kernel_mmr_size: header.kernel_mmr_size, total_kernel_offset, total_script_offset,