def load_expected_snapshots( snapshots_path ):
    """
    Load expected consensus hashes from a .snapshots file.
    Return the snapshots as a dict on success
    Return None on error
    """
    # use snapshots?
    snapshots_path = os.path.expanduser(snapshots_path)
    expected_snapshots = {}

    # legacy chainstate?
    try:
        with open(snapshots_path, "r") as f:
            snapshots_json = f.read()
        
        snapshots_data = json.loads(snapshots_json)
        assert 'snapshots' in snapshots_data.keys(), "Not a valid snapshots file"

        # extract snapshots: map int to consensus hash
        for (block_id_str, consensus_hash) in snapshots_data['snapshots'].items():
            expected_snapshots[ int(block_id_str) ] = str(consensus_hash)
        
        log.debug("Loaded expected snapshots from legacy JSON {}; {} entries".format(snapshots_path, len(expected_snapshots)))
        return expected_snapshots
    
    except ValueError as ve:
        log.debug("Snapshots file {} is not JSON".format(snapshots_path))

    except Exception as e:
        if os.environ.get('BLOCKSTACK_DEBUG') == '1':
            log.exception(e)

        log.debug("Failed to read expected snapshots from '{}'".format(snapshots_path))
        return None

    try:
        # sqlite3 db?
        db_con = virtualchain.StateEngine.db_connect(snapshots_path)
        expected_snapshots = virtualchain.StateEngine.get_consensus_hashes(None, None, db_con=db_con, completeness_check=False)
        log.debug("Loaded expected snapshots from chainstate DB {}, {} entries".format(snapshots_path, len(expected_snapshots)))
        return expected_snapshots

    except:
        log.debug("{} does not appear to be a chainstate DB".format(snapshots_path))

    return None
Load expected consensus hashes from a .snapshots file.
    Return the snapshots as a dict on success
    Return None on error