Generate a subdomains db from scratch, using the names db and the atlas db and zone file collection.
        Best to do this in a one-off command (i.e. *not* in the blockstackd process)

def reindex(cls, lastblock, firstblock=None, opts=None):
        """
        Generate a subdomains db from scratch, using the names db and the atlas db and zone file collection.
        Best to do this in a one-off command (i.e. *not* in the blockstackd process)
        """
        if opts is None:
            opts = get_blockstack_opts()

        if not is_atlas_enabled(opts):
            raise Exception("Atlas is not enabled")

        if not is_subdomains_enabled(opts):
            raise Exception("Subdomain support is not enabled")

        subdomaindb_path = opts['subdomaindb_path']
        atlasdb_path = opts['atlasdb_path']
        
        if not os.path.exists(atlasdb_path):
            raise Exception("No Atlas database at {}".format(opts['atlasdb_path']))
        
        subdomain_indexer = SubdomainIndex(subdomaindb_path, blockstack_opts=opts)
        subdomain_indexer.subdomain_db.wipe()

        if firstblock is None:
            start_block = SUBDOMAINS_FIRST_BLOCK
        else:
            start_block = firstblock

        for i in range(start_block, lastblock, 100):
            log.debug("Processing all subdomains in blocks {}-{}...".format(i, i+99))
            subdomain_indexer.index_blockchain(i, i+100)

        log.debug("Finished indexing subdomains in blocks {}-{}".format(start_block, lastblock))