From 466550298c0b1ac321fbf0ce9a02abaa5e644a39 Mon Sep 17 00:00:00 2001 From: Josep M Sobrepere Date: Wed, 6 Nov 2024 22:53:34 +0100 Subject: [PATCH] fix best-block not set issue --- lib/src/transactions/light_pool.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/transactions/light_pool.rs b/lib/src/transactions/light_pool.rs index aa96f3c0e4..6aa1072c22 100644 --- a/lib/src/transactions/light_pool.rs +++ b/lib/src/transactions/light_pool.rs @@ -818,6 +818,9 @@ where &mut self, new_finalized_block_hash: &[u8; 32], ) -> impl Iterator { + if self.best_block_index.is_none() { + let _ = self.set_best_block(new_finalized_block_hash); + } let new_finalized_block_index = if *new_finalized_block_hash == self.blocks_tree_root_hash { assert!(self.finalized_block_index.is_none()); return Vec::new().into_iter(); @@ -1068,9 +1071,7 @@ where }); } - // We returned earlier in the function if `finalized_node_index` is `None`. Consequently, - // `best_block_index` can't be `None` either. - if self.best_block_index.unwrap() == upmost_to_remove { + if self.best_block_index == Some(upmost_to_remove) { self.best_block_index = None; }