public async Task ExecuteEth1GenesisAsync(CancellationToken stoppingToken) { int count = 1; while (!stoppingToken.IsCancellationRequested) { if (_logger.IsEnabled(LogLevel.Debug)) { LogDebug.CheckingForEth1Genesis(_logger, count, null); } var eth1GenesisData = await _eth1GenesisProvider.GetEth1GenesisDataAsync(stoppingToken) .ConfigureAwait(false); var genesisSuccess = await _eth1Genesis.TryGenesisAsync(eth1GenesisData.BlockHash, eth1GenesisData.Timestamp, eth1GenesisData.Deposits).ConfigureAwait(false); if (genesisSuccess) { if (_logger.IsEnabled(LogLevel.Information)) { Log.Eth1GenesisSuccess(_logger, eth1GenesisData.BlockHash, eth1GenesisData.Timestamp, eth1GenesisData.Deposits.Count, count, null); } break; } await Task.Delay(_genesisCheckDelay); count++; } }
public override async Task StopAsync(CancellationToken cancellationToken) { if (_logger.IsDebug()) { LogDebug.PeeringWorkerStopping(_logger, null); } await base.StopAsync(cancellationToken); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { if (_logger.IsDebug()) { LogDebug.PeeringWorkerExecute(_logger, null); } if (_anchorStateOptions.CurrentValue.Source == AnchorStateSource.Eth1Genesis) { await ExecuteEth1GenesisAsync(stoppingToken); } // TODO: Any other work for the Eth1Bridge, e.g. maybe need IEth1Collection or similar interface that needs to be run }