예제 #1
0
        public TestPoAMiner(
            IConsensusManager consensusManager,
            IDateTimeProvider dateTimeProvider,
            Network network,
            INodeLifetime nodeLifetime,
            ILoggerFactory loggerFactory,
            IInitialBlockDownloadState ibdState,
            BlockDefinition blockDefinition,
            ISlotsManager slotsManager,
            IConnectionManager connectionManager,
            PoABlockHeaderValidator poaHeaderValidator,
            IFederationManager federationManager,
            IFederationHistory federationHistory,
            IIntegrityValidator integrityValidator,
            IWalletManager walletManager,
            INodeStats nodeStats,
            VotingManager votingManager,
            PoASettings poAMinerSettings,
            IAsyncProvider asyncProvider,
            IIdleFederationMembersKicker idleFederationMembersKicker,
            NodeSettings nodeSettings)
            : base(consensusManager, dateTimeProvider, network, nodeLifetime, loggerFactory, ibdState, blockDefinition, slotsManager,
                   connectionManager, poaHeaderValidator, federationManager, federationHistory, integrityValidator, walletManager, nodeStats, votingManager, poAMinerSettings, asyncProvider, idleFederationMembersKicker, nodeSettings)
        {
            this.timeProvider = dateTimeProvider as EditableTimeProvider;

            this.cancellation = new CancellationTokenSource();
            this.slotsManager = slotsManager;
        }
예제 #2
0
        public PoAMiner(
            IConsensusManager consensusManager,
            IDateTimeProvider dateTimeProvider,
            Network network,
            INodeLifetime nodeLifetime,
            ILoggerFactory loggerFactory,
            IInitialBlockDownloadState ibdState,
            BlockDefinition blockDefinition,
            ISlotsManager slotsManager,
            IConnectionManager connectionManager,
            PoABlockHeaderValidator poaHeaderValidator,
            IFederationManager federationManager,
            IFederationHistory federationHistory,
            IIntegrityValidator integrityValidator,
            IWalletManager walletManager,
            INodeStats nodeStats,
            VotingManager votingManager,
            PoASettings poAMinerSettings,
            IAsyncProvider asyncProvider,
            IIdleFederationMembersKicker idleFederationMembersKicker,
            NodeSettings nodeSettings)
        {
            this.consensusManager            = consensusManager;
            this.dateTimeProvider            = dateTimeProvider;
            this.network                     = network as PoANetwork;
            this.ibdState                    = ibdState;
            this.blockDefinition             = blockDefinition;
            this.slotsManager                = slotsManager;
            this.connectionManager           = connectionManager;
            this.poaHeaderValidator          = poaHeaderValidator;
            this.federationManager           = federationManager;
            this.federationHistory           = federationHistory;
            this.integrityValidator          = integrityValidator;
            this.walletManager               = walletManager;
            this.votingManager               = votingManager;
            this.poaSettings                 = poAMinerSettings;
            this.asyncProvider               = asyncProvider;
            this.idleFederationMembersKicker = idleFederationMembersKicker;
            this.nodeLifetime                = nodeLifetime;

            this.logger            = loggerFactory.CreateLogger(this.GetType().FullName);
            this.cancellation      = CancellationTokenSource.CreateLinkedTokenSource(new[] { nodeLifetime.ApplicationStopping });
            this.votingDataEncoder = new VotingDataEncoder();
            this.nodeSettings      = nodeSettings;

            this.miningStatistics = new MiningStatisticsModel();

            nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component, this.GetType().Name);
        }
예제 #3
0
 public CollateralPoAMiner(IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, Network network, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory,
                           IInitialBlockDownloadState ibdState, BlockDefinition blockDefinition, ISlotsManager slotsManager, IConnectionManager connectionManager, JoinFederationRequestMonitor joinFederationRequestMonitor,
                           PoABlockHeaderValidator poaHeaderValidator, IFederationManager federationManager, IFederationHistory federationHistory, IIntegrityValidator integrityValidator, IWalletManager walletManager, ChainIndexer chainIndexer,
                           INodeStats nodeStats, VotingManager votingManager, PoASettings poAMinerSettings, ICollateralChecker collateralChecker, IAsyncProvider asyncProvider, ICounterChainSettings counterChainSettings,
                           IIdleFederationMembersKicker idleFederationMembersKicker,
                           NodeSettings nodeSettings)
     : base(consensusManager, dateTimeProvider, network, nodeLifetime, loggerFactory, ibdState, blockDefinition, slotsManager, connectionManager,
            poaHeaderValidator, federationManager, federationHistory, integrityValidator, walletManager, nodeStats, votingManager, poAMinerSettings, asyncProvider, idleFederationMembersKicker, nodeSettings)
 {
     this.counterChainNetwork          = counterChainSettings.CounterChainNetwork;
     this.collateralChecker            = collateralChecker;
     this.encoder                      = new CollateralHeightCommitmentEncoder();
     this.chainIndexer                 = chainIndexer;
     this.joinFederationRequestMonitor = joinFederationRequestMonitor;
 }
        public void Initialize(IIdleFederationMembersKicker idleFederationMembersKicker = null)
        {
            this.idleFederationMembersKicker = idleFederationMembersKicker;

            this.pollsRepository.Initialize();

            this.polls = this.pollsRepository.GetAllPolls();

            this.blockConnectedSubscription    = this.signals.Subscribe <BlockConnected>(this.OnBlockConnected);
            this.blockDisconnectedSubscription = this.signals.Subscribe <BlockDisconnected>(this.OnBlockDisconnected);

            this.nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component, this.GetType().Name, 1200);

            this.isInitialized = true;
            this.logger.LogDebug("VotingManager initialized.");
        }
예제 #5
0
        public ReconstructFederationService(
            IFederationManager federationManager,
            NodeSettings nodeSettings,
            Network network,
            IIdleFederationMembersKicker idleFederationMembersKicker,
            VotingManager votingManager)
        {
            this.federationManager           = federationManager;
            this.idleFederationMembersKicker = idleFederationMembersKicker;
            this.nodeSettings  = nodeSettings;
            this.votingManager = votingManager;

            this.locker = new object();
            this.logger = LogManager.GetCurrentClassLogger();
            this.poaConsensusOptions = (PoAConsensusOptions)network.Consensus.Options;
        }
        public FederationController(
            ChainIndexer chainIndexer,
            IFederationManager federationManager,
            VotingManager votingManager,
            Network network,
            IIdleFederationMembersKicker idleFederationMembersKicker,
            ReconstructFederationService reconstructFederationService)
        {
            this.chainIndexer                = chainIndexer;
            this.federationManager           = federationManager;
            this.idleFederationMembersKicker = idleFederationMembersKicker;
            this.network = network;
            this.reconstructFederationService = reconstructFederationService;
            this.votingManager = votingManager;

            this.logger = LogManager.GetCurrentClassLogger();
        }
        public DefaultVotingController(
            IFederationManager fedManager,
            ILoggerFactory loggerFactory,
            VotingManager votingManager,
            IWhitelistedHashesRepository whitelistedHashesRepository,
            Network network,
            IPollResultExecutor pollExecutor,
            IIdleFederationMembersKicker idleFederationMembersKicker)
        {
            this.fedManager = fedManager;
            this.idleFederationMembersKicker = idleFederationMembersKicker;
            this.network       = network;
            this.pollExecutor  = pollExecutor;
            this.votingManager = votingManager;
            this.whitelistedHashesRepository = whitelistedHashesRepository;

            this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
        }
예제 #8
0
        public PoAFeature(
            IFederationManager federationManager,
            PayloadProvider payloadProvider,
            IConnectionManager connectionManager,
            ChainIndexer chainIndexer,
            IInitialBlockDownloadState initialBlockDownloadState,
            IConsensusManager consensusManager,
            IPeerBanning peerBanning,
            ILoggerFactory loggerFactory,
            VotingManager votingManager,
            IFederationHistory federationHistory,
            Network network,
            IWhitelistedHashesRepository whitelistedHashesRepository,
            IIdleFederationMembersKicker idleFederationMembersKicker,
            IChainState chainState,
            IBlockStoreQueue blockStoreQueue,
            NodeSettings nodeSettings,
            ReconstructFederationService reconstructFederationService,
            IPoAMiner miner = null
            )
        {
            this.federationManager         = federationManager;
            this.connectionManager         = connectionManager;
            this.chainIndexer              = chainIndexer;
            this.initialBlockDownloadState = initialBlockDownloadState;
            this.consensusManager          = consensusManager;
            this.peerBanning                  = peerBanning;
            this.loggerFactory                = loggerFactory;
            this.miner                        = miner;
            this.votingManager                = votingManager;
            this.federationHistory            = federationHistory;
            this.whitelistedHashesRepository  = whitelistedHashesRepository;
            this.network                      = network;
            this.idleFederationMembersKicker  = idleFederationMembersKicker;
            this.chainState                   = chainState;
            this.blockStoreQueue              = blockStoreQueue;
            this.nodeSettings                 = nodeSettings;
            this.reconstructFederationService = reconstructFederationService;

            payloadProvider.DiscoverPayloads(this.GetType().Assembly);
        }