From a69a848590aa0fd22f10cf0f1ea19b8ff3b37a82 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Thu, 26 Mar 2026 10:48:18 +1100 Subject: [PATCH] Remove expect --- consensus/proto_array/src/error.rs | 1 + consensus/proto_array/src/proto_array.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/consensus/proto_array/src/error.rs b/consensus/proto_array/src/error.rs index 04e747f5f6..bb5eea569d 100644 --- a/consensus/proto_array/src/error.rs +++ b/consensus/proto_array/src/error.rs @@ -60,6 +60,7 @@ pub enum Error { BrokenBlock { block_root: Hash256, }, + NoViableChildren, } impl From for Error { diff --git a/consensus/proto_array/src/proto_array.rs b/consensus/proto_array/src/proto_array.rs index 3f8db8d1fb..e3671eef7d 100644 --- a/consensus/proto_array/src/proto_array.rs +++ b/consensus/proto_array/src/proto_array.rs @@ -1338,7 +1338,7 @@ impl ProtoArray { (*weight, child.root, *payload_status_tiebreaker) }) .map(|(child, _, _)| child) - .expect("children is non-empty"); + .ok_or(Error::NoViableChildren)?; } }