コード例 #1
0
        public async Task <bool> TryGenesisAsync(Hash32 eth1BlockHash, ulong eth1Timestamp, IList <Deposit> deposits)
        {
            return(await Task.Run(() =>
            {
                if (_logger.IsDebug())
                {
                    _logger.LogDebug(Event.TryGenesis, "Try genesis with ETH1 block {Eth1BlockHash}, time {Eth1Timestamp}, with {DepositCount} deposits.", eth1BlockHash, eth1Timestamp, deposits.Count);
                }

                var candidateState = _genesis.InitializeBeaconStateFromEth1(eth1BlockHash, eth1Timestamp, deposits);
                if (_genesis.IsValidGenesisState(candidateState))
                {
                    var genesisState = candidateState;
                    _ = _forkChoice.GetGenesisStore(genesisState);
                    return true;
                }
                return false;
            }));
        }
コード例 #2
0
ファイル: ChainStart.cs プロジェクト: sounak98/nethermind
        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;
            }));
        }