Function bdk_chain::bitcoin::merkle_tree::calculate_root

pub fn calculate_root<T, I>(hashes: I) -> Option<T>
where T: Hash + Encodable, <T as Hash>::Engine: Write, I: Iterator<Item = T>,
Expand description

Calculates the merkle root of an iterator of hashes.

ยงReturns

  • None if hashes is empty. The merkle root of an empty tree of hashes is undefined.
  • Some(hash) if hashes contains one element. A single hash is by definition the merkle root.
  • Some(merkle_root) if length of hashes is greater than one.