Exemplo n.º 1
0
        public VotingManager(
            IFederationManager federationManager,
            IPollResultExecutor pollResultExecutor,
            INodeStats nodeStats,
            DataFolder dataFolder,
            DBreezeSerializer dBreezeSerializer,
            ISignals signals,
            Network network,
            ChainIndexer chainIndexer,
            IBlockRepository blockRepository = null,
            INodeLifetime nodeLifetime       = null)
        {
            this.federationManager  = Guard.NotNull(federationManager, nameof(federationManager));
            this.pollResultExecutor = Guard.NotNull(pollResultExecutor, nameof(pollResultExecutor));
            this.signals            = Guard.NotNull(signals, nameof(signals));
            this.nodeStats          = Guard.NotNull(nodeStats, nameof(nodeStats));

            this.locker              = new object();
            this.votingDataEncoder   = new VotingDataEncoder();
            this.scheduledVotingData = new List <VotingData>();
            this.PollsRepository     = new PollsRepository(chainIndexer, dataFolder, dBreezeSerializer, network as PoANetwork);

            this.logger              = LogManager.GetCurrentClassLogger();
            this.network             = network;
            this.poaConsensusOptions = (PoAConsensusOptions)this.network.Consensus.Options;

            Guard.Assert(this.poaConsensusOptions.PollExpiryBlocks != 0);

            this.blockRepository = blockRepository;
            this.chainIndexer    = chainIndexer;
            this.nodeLifetime    = nodeLifetime;

            this.isInitialized = false;
        }
Exemplo n.º 2
0
        public VotingManager(IFederationManager federationManager, ILoggerFactory loggerFactory, IPollResultExecutor pollResultExecutor,
                             INodeStats nodeStats, DataFolder dataFolder, DBreezeSerializer dBreezeSerializer, ISignals signals,
                             Network network,
                             IBlockRepository blockRepository = null,
                             ChainIndexer chainIndexer        = null,
                             INodeLifetime nodeLifetime       = null,
                             NodeSettings nodeSettings        = null)
        {
            this.federationManager  = Guard.NotNull(federationManager, nameof(federationManager));
            this.pollResultExecutor = Guard.NotNull(pollResultExecutor, nameof(pollResultExecutor));
            this.signals            = Guard.NotNull(signals, nameof(signals));
            this.nodeStats          = Guard.NotNull(nodeStats, nameof(nodeStats));

            this.locker              = new object();
            this.votingDataEncoder   = new VotingDataEncoder(loggerFactory);
            this.scheduledVotingData = new List <VotingData>();
            this.PollsRepository     = new PollsRepository(dataFolder, loggerFactory, dBreezeSerializer, chainIndexer, nodeSettings);

            this.logger              = loggerFactory.CreateLogger(this.GetType().FullName);
            this.network             = network;
            this.poaConsensusOptions = (PoAConsensusOptions)this.network.Consensus.Options;

            this.blockRepository = blockRepository;
            this.chainIndexer    = chainIndexer;
            this.nodeLifetime    = nodeLifetime;

            this.isInitialized = false;
        }
Exemplo n.º 3
0
        public VotingManager(FederationManager federationManager, ILoggerFactory loggerFactory, SlotsManager slotsManager, IPollResultExecutor pollResultExecutor,
                             INodeStats nodeStats, DataFolder dataFolder, DBreezeSerializer dBreezeSerializer, ISignals signals, IFinalizedBlockInfoRepository finalizedBlockInfo)
        {
            this.federationManager  = Guard.NotNull(federationManager, nameof(federationManager));
            this.slotsManager       = Guard.NotNull(slotsManager, nameof(slotsManager));
            this.pollResultExecutor = Guard.NotNull(pollResultExecutor, nameof(pollResultExecutor));
            this.signals            = Guard.NotNull(signals, nameof(signals));
            this.nodeStats          = Guard.NotNull(nodeStats, nameof(nodeStats));
            this.finalizedBlockInfo = Guard.NotNull(finalizedBlockInfo, nameof(finalizedBlockInfo));

            this.locker              = new object();
            this.votingDataEncoder   = new VotingDataEncoder(loggerFactory);
            this.scheduledVotingData = new List <VotingData>();
            this.pollsRepository     = new PollsRepository(dataFolder, loggerFactory, dBreezeSerializer);
            this.logger              = loggerFactory.CreateLogger(this.GetType().FullName);

            this.isInitialized = false;
        }