function encodeHashes(encoder, hashes) {
  if (!Array.isArray(hashes)) throw new TypeError("hashes must be an array")
  encoder.appendUint32(hashes.length)
  for (let i = 0; i < hashes.length; i++) {
    if (i > 0 && hashes[i - 1] >= hashes[i])
      throw new RangeError("hashes must be sorted")
    const bytes = hexStringToBytes(hashes[i])
    if (bytes.byteLength !== HASH_SIZE)
      throw new TypeError("heads hashes must be 256 bits")
    encoder.appendRawBytes(bytes)
  }
}
Encodes a sorted array of SHA-256 hashes (as hexadecimal strings) into a byte array.