def __init__(self, hex_hashes, hash_function=bin_double_sha256):
        """
        Make a merkle tree.
        * hashes is a list of hex-encoded hashes.
        * hash_function is a callable that takes a string as input and outputs a hash.

        The Merkle tree hashes will be converted to big-endian.
        """
        if len(hex_hashes) == 0:
            raise ValueError("At least one hash is required.")

        self.rows = []
        
        # convert to binary big-endian
        hashes = [hex_to_bin_reversed(h) for h in hex_hashes]
        
        # build the rows of the merkle tree
        self.rows.append(hashes)
        while len(hashes) > 1:
            hashes = calculate_merkle_pairs(hashes, hash_function=hash_function)
            self.rows.append(hashes)
def __init__ ( self , hex_hashes , hash_function = bin_double_sha256 ) : if len ( hex_hashes ) == 0 : raise ValueError ( "At least one hash is required." ) self . rows = [ ] hashes = [ hex_to_bin_reversed ( h ) for h in hex_hashes ] self . rows . append ( hashes ) while len ( hashes ) > 1 : hashes = calculate_merkle_pairs ( hashes , hash_function = hash_function ) self . rows . append ( hashes )
Make a merkle tree.
        * hashes is a list of hex-encoded hashes.
        * hash_function is a callable that takes a string as input and outputs a hash.

        The Merkle tree hashes will be converted to big-endian.