INNER CODE UNIT · Rust
finalized_root
risc0/risc0-ethereum · crates/aggregation/src/lib.rs:267
pub fn finalized_root(mut self) -> Option<Digest> {
match self.is_empty() {
true => None,
false => {
// finalize should only fail if the MMR is empty.
self.finalize().unwrap();
Some(self.0[0].digest)
}
}
}
/// Returns true if the [MerkleMountainRange] is finalized. No new nodes can be added to a
/// finalized [MerkleMountainRange].
pub fn is_finalized(&self) -> bool {
// If the peak has a max-depth of 255, then the mountain range is finalized and no new
// peaks can be pushed to it. Note that this state can only be achieved by calling
// `finalize` since it is computationally infeasible to push 2^256 nodes onto the MMR,
// although it is theoretically consistent that if an MMR reached a state of being a