Look up the sequence of zone file records by name, optionally up to a specific zonefile index
    Returns [{'zonefile_hash': ..., 'txid': ..., 'inv_index': ..., 'block_height': ..., 'present': ..., 'tried_storage': ...}], in blockchain order

def atlasdb_get_zonefiles_by_name(name, max_index=None, con=None, path=None):
    """
    Look up the sequence of zone file records by name, optionally up to a specific zonefile index
    Returns [{'zonefile_hash': ..., 'txid': ..., 'inv_index': ..., 'block_height': ..., 'present': ..., 'tried_storage': ...}], in blockchain order
    """
    ret = []
    with AtlasDBOpen(con=con, path=path) as dbcon:

        sql = 'SELECT * FROM zonefiles WHERE name = ? ORDER BY inv_index'
        args = (name,)

        if max_index:
            sql += ' AND inv_index <= ?'
            args += (max_index,)

        sql += ';'

        cur = dbcon.cursor()
        res = atlasdb_query_execute(cur, sql, args)

        for zfinfo in res:
            row = {}
            row.update(zfinfo)
            ret.append(row)

    return ret