From 4d44fb56f5962dcde21b9d108e419e60e93394b5 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Tue, 20 Jul 2021 09:45:36 -0600 Subject: [PATCH] Apply suggestions from code review Co-authored-by: str4d Co-authored-by: ying tong --- src/bridgetree.rs | 8 ++++---- src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bridgetree.rs b/src/bridgetree.rs index 3e20ed2..90f3cd3 100644 --- a/src/bridgetree.rs +++ b/src/bridgetree.rs @@ -38,7 +38,7 @@ impl Position { }) } - /// Returns the altitude of each populated ommer + /// Returns the altitude of each populated ommer. pub fn ommer_altitudes(&self) -> impl Iterator + '_ { (0..=self.max_altitude().0) .into_iter() @@ -58,7 +58,7 @@ impl Position { } /// Returns the altitude of each cousin and/or ommer required to construct - /// an authentication path to the root of a merkle tree of depth `self + 1` + /// an authentication path to the root of a merkle tree that has `self + 1` /// nodes. pub fn altitudes_required(&self) -> impl Iterator + '_ { (0..=(self.max_altitude() + 1).0) @@ -316,7 +316,7 @@ impl Frontier { /// Returns `None` if the provided frontier exceeds the maximum /// allowed depth. pub fn new(frontier: NonEmptyFrontier) -> Option { - if frontier.size() >= 1 << DEPTH { + if frontier.size() > 1 << DEPTH { None } else { Some(Frontier { @@ -392,7 +392,7 @@ pub struct AuthFragment { } impl AuthFragment { - /// Construct the new empty authenticaiton path fragment for the specified position. + /// Construct the new empty authentication path fragment for the specified position. pub fn new(position: Position) -> Self { AuthFragment { position, diff --git a/src/lib.rs b/src/lib.rs index 46db1b2..9de5481 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,7 +40,7 @@ use std::ops::Sub; pub struct Altitude(u8); impl Altitude { - /// Convenience method for returning the zero altitude + /// Convenience method for returning the zero altitude. pub fn zero() -> Self { Altitude(0) }