def namedb_get_record_states_at(cur, history_id, block_number):
    """
    Get the state(s) that the given history record was in at a given block height.
    Normally, this is one state (i.e. if a name was registered at block 8, then it is in a NAME_REGISTRATION state in block 10)

    However, if the record changed at this block, then this method returns all states the record passed through.

    Returns an array of record states
    """
    query = 'SELECT block_id,history_data FROM history WHERE history_id = ? AND block_id == ? ORDER BY block_id DESC,vtxindex DESC'
    args = (history_id, block_number)
    history_rows = namedb_query_execute(cur, query, args)
    ret = []

    for row in history_rows:
        history_data = simplejson.loads(row['history_data'])
        ret.append(history_data)

    if len(ret) > 0:
        # record changed in this block
        return ret
    
    # if the record did not change in this block, then find the last version of the record
    query = 'SELECT block_id,history_data FROM history WHERE history_id = ? AND block_id < ? ORDER BY block_id DESC,vtxindex DESC LIMIT 1'
    args = (history_id, block_number)
    history_rows = namedb_query_execute(cur, query, args)
    
    for row in history_rows:
        history_data = simplejson.loads(row['history_data'])
        ret.append(history_data)

    return ret