Apply suggestions from code review

Co-authored-by: str4d <jack@electriccoin.co>
Co-authored-by: ying tong <yingtong@z.cash>
This commit is contained in:
Kris Nuttycombe 2021-07-20 09:45:36 -06:00 committed by GitHub
parent 9dfc9ecdcc
commit 4d44fb56f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -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<Item = Altitude> + '_ {
(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<Item = Altitude> + '_ {
(0..=(self.max_altitude() + 1).0)
@ -316,7 +316,7 @@ impl<H, const DEPTH: u8> Frontier<H, DEPTH> {
/// Returns `None` if the provided frontier exceeds the maximum
/// allowed depth.
pub fn new(frontier: NonEmptyFrontier<H>) -> Option<Self> {
if frontier.size() >= 1 << DEPTH {
if frontier.size() > 1 << DEPTH {
None
} else {
Some(Frontier {
@ -392,7 +392,7 @@ pub struct AuthFragment<A> {
}
impl<A> AuthFragment<A> {
/// 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,

View File

@ -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)
}