Function bdk_chain::bitcoin::merkle_tree::calculate_root_inline

pub fn calculate_root_inline<T>(hashes: &mut [T]) -> Option<T>
where T: Hash + Encodable, <T as Hash>::Engine: Write,
Expand description

Calculates the merkle root of a list of hashes, inline (in place) in hashes.

In most cases, you’ll want to use calculate_root instead. Please note, calling this function trashes the data in hashes (i.e. the hashes is left in an undefined state at conclusion of this method and should not be used again afterwards).

§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.