From b5805b779a110a221446b53328b1387667b55292 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Wed, 7 Aug 2019 06:20:46 -0700 Subject: [PATCH] chain/state: Avoid panicking in update_consensus_state Previously this codepath assumed the `ConsensusState` `block_ids`are `Some(...)` as the logic above used to explicitly check for it. This was recently changed to allow them to be `None` (a.k.a. ``), causing a panic in the event they are `None` (and a `PoisonError`, since they're holding a mutex on the chain state. This uses a helper method which handles both cases and displays `` in the event they're none. --- src/chain/state.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chain/state.rs b/src/chain/state.rs index cd9a11d7..b48cc569 100644 --- a/src/chain/state.rs +++ b/src/chain/state.rs @@ -111,8 +111,8 @@ impl State { new_state.height, new_state.round, new_state.step, - self.consensus_state.block_id.as_ref().unwrap(), - new_state.block_id.unwrap() + self.consensus_state.block_id_prefix(), + new_state.block_id_prefix() ) } }