From 799fff8cbab68b92bc9a737bf0331d31cffdfd24 Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:39:29 +0200 Subject: [PATCH] fix: ensure datastore is consistently updated on new blocks --- components/clarity-repl/src/repl/datastore.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/clarity-repl/src/repl/datastore.rs b/components/clarity-repl/src/repl/datastore.rs index 0080e26b2..5ff6c44e3 100644 --- a/components/clarity-repl/src/repl/datastore.rs +++ b/components/clarity-repl/src/repl/datastore.rs @@ -501,12 +501,12 @@ impl Datastore { clarity_datastore .block_id_lookup - .insert(id, current_lookup_id) - .expect("failed to insert block id into lookup table"); + .entry(id) + .or_insert(current_lookup_id); clarity_datastore .height_at_chain_tip - .insert(id, self.stacks_chain_height) - .expect("failed to insert height into chain tip table"); + .entry(id) + .or_insert(self.stacks_chain_height); clarity_datastore.open_chain_tip = height_to_id(self.stacks_chain_height); clarity_datastore.current_chain_tip = clarity_datastore.open_chain_tip; }