Пример #1
0
        public async Task InitNetworkProtocol()
        {
            var(getFromAPi, _) = _api.ForNetwork;
            INetworkConfig networkConfig = _api.Config <INetworkConfig>();
            IInitConfig    initConfig    = _api.Config <IInitConfig>();

            if (_isOn)
            {
                string instanceId = $"{_ethStatsConfig.Name}-{Keccak.Compute(getFromAPi.Enode!.Info)}";
                if (_logger.IsInfo)
                {
                    _logger.Info($"Initializing ETH Stats for the instance: {instanceId}, server: {_ethStatsConfig.Server}");
                }
                MessageSender sender = new(instanceId, _api.LogManager);
                const int     reconnectionInterval = 5000;
                const string  api              = "no";
                const string  client           = "0.1.1";
                const bool    canUpdateHistory = false;
                string        node             = ClientVersion.Description;
                int           port             = networkConfig.P2PPort;
                string        network          = _api.SpecProvider !.ChainId.ToString();
                string        protocol         = $"{P2PProtocolInfoProvider.DefaultCapabilitiesToString()}";

                _ethStatsClient = new EthStatsClient(
                    _ethStatsConfig.Server,
                    reconnectionInterval,
                    sender,
                    _api.LogManager);

                _ethStatsIntegration = new EthStatsIntegration(
                    _ethStatsConfig.Name !,
                    node,
                    port,
                    network,
                    protocol,
                    api,
                    client,
                    _ethStatsConfig.Contact !,
                    canUpdateHistory,
                    _ethStatsConfig.Secret !,
                    _ethStatsClient,
                    sender,
                    getFromAPi.TxPool,
                    getFromAPi.BlockTree,
                    getFromAPi.PeerManager,
                    getFromAPi.GasPriceOracle,
                    getFromAPi.EthSyncingInfo !,
                    initConfig.IsMining,
                    getFromAPi.LogManager);

                await _ethStatsIntegration.InitAsync();
            }
        }
 public GammaTaskData()
 {
     ChainId             = Guid.NewGuid();
     FieldWithCommonName = ChainId.ToString();
 }
Пример #3
0
 public override string ToString()
 {
     return($"{ChainId.ToString().Substring(30)}-{Id}");
 }