Esempio n. 1
0
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)
Esempio n. 2
0
def is_database_initialized(chaindb: ChainDatabaseAPI) -> bool:
    try:
        chaindb.get_canonical_head()
    except CanonicalHeadNotFound:
        # empty chain database
        return False
    else:
        return True