function tapleafHash(leaf) {
  const version = leaf.version || LEAF_VERSION_TAPSCRIPT;
  return bcrypto.taggedHash(
    'TapLeaf',
    tools.concat([Uint8Array.from([version]), serializeScript(leaf.output)]),
  );
}
Calculates the tapleaf hash for a given Tapleaf object.
@param leaf - The Tapleaf object to calculate the hash for.
@returns The tapleaf hash as a Buffer.