/// <summary>
        ///
        /// </summary>
        /// <param name="serfClient"></param>
        /// <param name="signingProvider"></param>
        /// <param name="logger"></param>
        public MembershipService(ISerfClient serfClient, ISigning signingProvider, ILogger logger)
        {
            _serfClient      = serfClient;
            _signingProvider = signingProvider;
            _logger          = logger.ForContext("SourceContext", nameof(MembershipService));

            Ready();
        }
示例#2
0
        public SerfService(ISerfClient serfClient, ISigning signing, ILogger logger)
        {
            _serfClient = serfClient;
            _signing    = signing;
            _logger     = logger.ForContext("SourceContext", nameof(SerfService));

            _tcpSession = _serfClient.TcpSessionsAddOrUpdate(new TcpSession(
                                                                 serfClient.SerfConfigurationOptions.Listening).Connect(_serfClient.SerfConfigurationOptions.RPC));
        }
示例#3
0
        public Validator(IUnitOfWork unitOfWork, ISigning signing, ILogger logger)
        {
            _unitOfWork = unitOfWork;
            _signing    = signing;
            _logger     = logger.ForContext("SourceContext", nameof(Validator));

            SetupTrie().SafeFireAndForget(exception =>
            {
                _logger.Here().Fatal(exception, "Unable to setup patricia trie");
            });
        }
示例#4
0
 public Graph(IUnitOfWork unitOfWork, ILocalNode localNode, ISerfClient serfClient, IValidator validator,
              ISigning signing, ISync sync, NetworkClient networkClient, ILogger logger)
 {
     _unitOfWork              = unitOfWork;
     _localNode               = localNode;
     _serfClient              = serfClient;
     _validator               = validator;
     _signing                 = signing;
     _sync                    = sync;
     _logger                  = logger;
     _pooledBlockGraphs       = new PooledList <BlockGraph>(MaxBlockGraphs);
     _trackingBlockGraphAdded = Observable.FromEventPattern <BlockGraphEventArgs>(
         ev => _blockGraphAddedEventHandler        += ev, ev => _blockGraphAddedEventHandler -= ev);
     _trackingBlockGraphCompleted                   = Observable.FromEventPattern <BlockGraphEventArgs>(
         ev => _blockGraphAddCompletedEventHandler += ev, ev => _blockGraphAddCompletedEventHandler -= ev);
     TryAddBlockGraphsListener();
     TryAddBlockmaniaListener();
     ReplayLastRound().SafeFireAndForget(exception => { _logger.Here().Error(exception, "Replay error"); });
 }
示例#5
0
        public PosMinting(IGraph graph, IMemoryPool memoryPool, ISerfClient serfClient, IUnitOfWork unitOfWork,
                          ISigning signing, IValidator validator, ISync sync, StakingConfigurationOptions stakingConfigurationOptions,
                          ILogger logger, IHostApplicationLifetime applicationLifetime)
        {
            _graph      = graph;
            _memoryPool = memoryPool;
            _serfClient = serfClient;
            _unitOfWork = unitOfWork;
            _signing    = signing;
            _validator  = validator;
            _sync       = sync;
            _stakingConfigurationOptions = stakingConfigurationOptions;
            _logger  = logger.ForContext("SourceContext", nameof(PosMinting));
            _keyPair = _signing.GetOrUpsertKeyName(_signing.DefaultSigningKeyName).GetAwaiter().GetResult();

            _stakingTimer      = new Timer(async _ => await Staking(), null, TimeSpan.FromSeconds(35), TimeSpan.FromSeconds(10));
            _decideWinnerTimer = new Timer(async _ => await DecideWinner(), null, TimeSpan.FromSeconds(40), TimeSpan.FromSeconds(20));

            applicationLifetime.ApplicationStopping.Register(OnApplicationStopping);
        }
示例#6
0
 public Validator(IUnitOfWork unitOfWork, ISigning signing, ILogger logger)
 {
     _unitOfWork = unitOfWork;
     _signing    = signing;
     _logger     = logger.ForContext("SourceContext", nameof(Validator));
 }
示例#7
0
 public SerfServiceTester(ISerfClient serfClient, ISigning signing, ILogger logger)
 {
     _serfClient = serfClient;
     _signing    = signing;
     _logger     = logger.ForContext("SourceContext", nameof(SerfServiceTester));
 }