cleanup path fn and add test coverage (#1201)
This commit is contained in:
@@ -712,14 +712,11 @@ pub fn is_left_sibling(pos: u64) -> bool {
|
||||
/// The size (and therefore the set of peaks) of the MMR
|
||||
/// is defined by last_pos.
|
||||
pub fn path(pos: u64, last_pos: u64) -> Vec<u64> {
|
||||
let mut path = vec![pos];
|
||||
let mut path = vec![];
|
||||
let mut current = pos;
|
||||
while current + 1 <= last_pos {
|
||||
while current <= last_pos {
|
||||
path.push(current);
|
||||
let (parent, _) = family(current);
|
||||
if parent > last_pos {
|
||||
break;
|
||||
}
|
||||
path.push(parent);
|
||||
current = parent;
|
||||
}
|
||||
path
|
||||
|
||||
Reference in New Issue
Block a user