diff --git a/p2p-repo/src/branch.rs b/p2p-repo/src/branch.rs index 7b7d7cf..985b144 100644 --- a/p2p-repo/src/branch.rs +++ b/p2p-repo/src/branch.rs @@ -130,7 +130,7 @@ impl Branch { let id = cobj.id(); // root has no deps - let is_root = cobj.deps().len() == 0; + let is_root = cobj.is_root(); //debug_println!(" deps: {:?}", cobj.deps()); // check if this commit object is present in their_heads diff --git a/p2p-repo/src/object.rs b/p2p-repo/src/object.rs index f38cc03..914e803 100644 --- a/p2p-repo/src/object.rs +++ b/p2p-repo/src/object.rs @@ -379,6 +379,11 @@ impl Object { } } + pub fn is_root(&self) -> bool { + self.deps().len() == 0 + //TODO: add && sdeps().len() == 0 && self.acks().len() == 0 && self.nacks().len() == 0 + } + pub fn root(&self) -> &Block { self.blocks.last().unwrap() }