Exemple #1
0
        /// <param name="eth1BlockHash"></param>
        /// <param name="eth1Timestamp"></param>
        /// <param name="deposits"></param>
        /// <returns></returns>
        public async Task <bool> TryGenesisAsync(Bytes32 eth1BlockHash, ulong eth1Timestamp)
        {
            if (_logger.IsDebug())
            {
                LogDebug.TryGenesis(_logger, eth1BlockHash, eth1Timestamp, (uint)_depositStore.Deposits.Count, null);
            }

            BeaconState candidateState = InitializeBeaconStateFromEth1(eth1BlockHash, eth1Timestamp);

            if (IsValidGenesisState(candidateState))
            {
                BeaconState genesisState = candidateState;
                await _forkChoice.InitializeForkChoiceStoreAsync(_store, genesisState);

                return(true);
            }

            return(false);
        }
Exemple #2
0
        public async Task <bool> TryGenesisAsync(Hash32 eth1BlockHash, ulong eth1Timestamp, IList <Deposit> deposits)
        {
            return(await Task.Run(() =>
            {
                if (_logger.IsDebug())
                {
                    LogDebug.TryGenesis(_logger, eth1BlockHash, eth1Timestamp, deposits.Count, null);
                }

                BeaconState candidateState = _genesis.InitializeBeaconStateFromEth1(eth1BlockHash, eth1Timestamp, deposits);
                if (_genesis.IsValidGenesisState(candidateState))
                {
                    BeaconState genesisState = candidateState;
                    _ = _forkChoice.GetGenesisStore(genesisState);
                    return true;
                }
                return false;
            }));
        }