Skip to content

Commit

Permalink
fix best-block not set issue
Browse files Browse the repository at this point in the history
  • Loading branch information
josepot committed Nov 6, 2024
1 parent 0a5f91a commit 4665502
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/src/transactions/light_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,9 @@ where
&mut self,
new_finalized_block_hash: &[u8; 32],
) -> impl Iterator<Item = ([u8; 32], TBl)> {
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();
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 4665502

Please sign in to comment.