Example #1
0
        protected override async Task SetupJobManager(CancellationToken ct)
        {
            manager = ctx.Resolve <EthereumJobManager>(
                new TypedParameter(typeof(IExtraNonceProvider), new EthereumExtraNonceProvider(poolConfig.Id, clusterConfig.InstanceId)));

            manager.Configure(poolConfig, clusterConfig);

            await manager.StartAsync(ct);

            if (poolConfig.EnableInternalStratum == true)
            {
                disposables.Add(manager.Jobs
                                .Select(job => Observable.FromAsync(() =>
                                                                    Guard(() => OnNewJobAsync(job),
                                                                          ex => logger.Debug(() => $"{nameof(OnNewJobAsync)}: {ex.Message}"))))
                                .Concat()
                                .Subscribe(_ => { }, ex =>
                {
                    logger.Debug(ex, nameof(OnNewJobAsync));
                }));

                // start with initial blocktemplate
                await manager.Jobs.Take(1).ToTask(ct);
            }

            else
            {
                // keep updating NetworkStats
                disposables.Add(manager.Jobs.Subscribe());
            }
        }
Example #2
0
        protected override async Task SetupJobManager(CancellationToken ct)
        {
            manager = ctx.Resolve <EthereumJobManager>();
            manager.Configure(poolConfig, clusterConfig);

            await manager.StartAsync(ct);

            if (poolConfig.EnableInternalStratum == true)
            {
                disposables.Add(manager.Jobs
                                .Select(x => Observable.FromAsync(() => OnNewJobAsync(x)))
                                .Concat()
                                .Subscribe(_ => { }, ex =>
                {
                    logger.Debug(ex, nameof(OnNewJobAsync));
                }));

                // we need work before opening the gates
                await manager.Jobs.Take(1).ToTask(ct);
            }

            else
            {
                // keep updating NetworkStats
                disposables.Add(manager.Jobs.Subscribe());
            }
        }
Example #3
0
        protected override async Task SetupJobManager(CancellationToken ct)
        {
            manager = ctx.Resolve <EthereumJobManager>(
                new TypedParameter(typeof(IExtraNonceProvider), new EthereumExtraNonceProvider(clusterConfig.InstanceId)));

            manager.Configure(poolConfig, clusterConfig);

            await manager.StartAsync(ct);

            if (poolConfig.EnableInternalStratum == true)
            {
                disposables.Add(manager.Jobs
                                .Select(job => Observable.FromAsync(async() =>
                {
                    try
                    {
                        await OnNewJobAsync(job);
                    }

                    catch (Exception ex)
                    {
                        logger.Debug(() => $"{nameof(OnNewJobAsync)}: {ex.Message}");
                    }
                }))
                                .Concat()
                                .Subscribe(_ => { }, ex =>
                {
                    logger.Debug(ex, nameof(OnNewJobAsync));
                }));

                // we need work before opening the gates
                await manager.Jobs.Take(1).ToTask(ct);
            }

            else
            {
                // keep updating NetworkStats
                disposables.Add(manager.Jobs.Subscribe());
            }
        }