Skip to content

Commit 89d7fd3

Browse files
committed
Update comments
1 parent e2312d2 commit 89d7fd3

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

consensus/proto_array/src/proto_array.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,12 @@ impl ProtoArray {
978978
/// ## Notes
979979
///
980980
/// Still returns `true` if `ancestor_root` is known and `ancestor_root == descendant_root`.
981+
///
982+
/// ## Warning
983+
///
984+
/// Do not use this function to check if a block is a descendant of the
985+
/// finalized checkpoint. Use `Self::is_finalized_checkpoint_or_descendant`
986+
/// instead.
981987
pub fn is_descendant(&self, ancestor_root: Hash256, descendant_root: Hash256) -> bool {
982988
self.indices
983989
.get(&ancestor_root)
@@ -991,12 +997,11 @@ impl ProtoArray {
991997
.unwrap_or(false)
992998
}
993999

994-
/// Returns `true` if the `descendant_root` has an ancestor with `ancestor_root`. Always
995-
/// returns `false` if either input root is unknown.
1000+
/// Returns `true` if `root` is equal to or a descendant of
1001+
/// `self.finalized_checkpoint`.
9961002
///
997-
/// ## Notes
998-
///
999-
/// Still returns `true` if `ancestor_root` is known and `ancestor_root == descendant_root`.
1003+
/// Notably, this function is checking ancestory of the finalized
1004+
/// *checkpoint* not the finalized *block*.
10001005
pub fn is_finalized_checkpoint_or_descendant<E: EthSpec>(&self, root: Hash256) -> bool {
10011006
let finalized_root = self.finalized_checkpoint.root;
10021007
let finalized_slot = self

0 commit comments

Comments
 (0)