def initialize_database(chain_config: Eth1ChainConfig, chaindb: ChainDatabaseAPI, base_db: AtomicDatabaseAPI) -> None: try: chaindb.get_canonical_head() except CanonicalHeadNotFound: chain_config.initialize_chain(base_db)
def is_database_initialized(chaindb: ChainDatabaseAPI) -> bool: try: chaindb.get_canonical_head() except CanonicalHeadNotFound: # empty chain database return False else: return True