Skip to content

Commit

Permalink
Update fork_choice function name
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Feb 9, 2023
1 parent 89d7fd3 commit dfc223c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ pub fn check_block_is_finalized_checkpoint_or_descendant<T: BeaconChainTypes>(
fork_choice: &BeaconForkChoice<T>,
block: &Arc<SignedBeaconBlock<T::EthSpec>>,
) -> Result<(), BlockError<T::EthSpec>> {
if fork_choice.is_descendant_of_finalized_checkpoint(block.parent_root()) {
if fork_choice.is_finalized_checkpoint_or_descendant(block.parent_root()) {
Ok(())
} else {
// If fork choice does *not* consider the parent to be a descendant of the finalized block,
Expand Down
10 changes: 5 additions & 5 deletions consensus/fork_choice/src/fork_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ where

if store.best_justified_checkpoint().epoch > store.justified_checkpoint().epoch {
let store = &self.fc_store;
if self.is_descendant_of_finalized_checkpoint(store.best_justified_checkpoint().root) {
if self.is_finalized_checkpoint_or_descendant(store.best_justified_checkpoint().root) {
let store = &mut self.fc_store;
store
.set_justified_checkpoint(*store.best_justified_checkpoint())
Expand Down Expand Up @@ -1324,12 +1324,12 @@ where
/// Returns `true` if the block is known **and** a descendant of the finalized root.
pub fn contains_block(&self, block_root: &Hash256) -> bool {
self.proto_array.contains_block(block_root)
&& self.is_descendant_of_finalized_checkpoint(*block_root)
&& self.is_finalized_checkpoint_or_descendant(*block_root)
}

/// Returns a `ProtoBlock` if the block is known **and** a descendant of the finalized root.
pub fn get_block(&self, block_root: &Hash256) -> Option<ProtoBlock> {
if self.is_descendant_of_finalized_checkpoint(*block_root) {
if self.is_finalized_checkpoint_or_descendant(*block_root) {
self.proto_array.get_block(block_root)
} else {
None
Expand All @@ -1338,7 +1338,7 @@ where

/// Returns an `ExecutionStatus` if the block is known **and** a descendant of the finalized root.
pub fn get_block_execution_status(&self, block_root: &Hash256) -> Option<ExecutionStatus> {
if self.is_descendant_of_finalized_checkpoint(*block_root) {
if self.is_finalized_checkpoint_or_descendant(*block_root) {
self.proto_array.get_block_execution_status(block_root)
} else {
None
Expand Down Expand Up @@ -1374,7 +1374,7 @@ where
}

/// Return `true` if `block_root` is equal to the finalized checkpoint, or a known descendant of it.
pub fn is_descendant_of_finalized_checkpoint(&self, block_root: Hash256) -> bool {
pub fn is_finalized_checkpoint_or_descendant(&self, block_root: Hash256) -> bool {
self.proto_array
.is_finalized_checkpoint_or_descendant::<E>(block_root)
}
Expand Down

0 comments on commit dfc223c

Please sign in to comment.