Object::is_root

Niko PLP 2 years ago
parent b4b24c21f1
commit 3ee9ded98a
  1. 2
      p2p-repo/src/branch.rs
  2. 5
      p2p-repo/src/object.rs

@ -130,7 +130,7 @@ impl Branch {
let id = cobj.id(); let id = cobj.id();
// root has no deps // root has no deps
let is_root = cobj.deps().len() == 0; let is_root = cobj.is_root();
//debug_println!(" deps: {:?}", cobj.deps()); //debug_println!(" deps: {:?}", cobj.deps());
// check if this commit object is present in their_heads // check if this commit object is present in their_heads

@ -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 { pub fn root(&self) -> &Block {
self.blocks.last().unwrap() self.blocks.last().unwrap()
} }

Loading…
Cancel
Save