Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DnsSeedServer"/> class with the port to listen on.
        /// </summary>
        /// <param name="client">The UDP client to use to receive DNS requests and send DNS responses.</param>
        /// <param name="masterFile">The initial DNS masterfile.</param>
        /// <param name="asyncProvider">The async loop factory.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <param name="dateTimeProvider">The <see cref="DateTime"/> provider.</param>
        /// <param name="dataFolders">The data folders of the system.</param>
        public DnsSeedServer(IUdpClient client, IMasterFile masterFile, IAsyncProvider asyncProvider, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, IDateTimeProvider dateTimeProvider, DnsSettings dnsSettings, DataFolder dataFolders)
        {
            Guard.NotNull(client, nameof(client));
            Guard.NotNull(masterFile, nameof(masterFile));
            Guard.NotNull(asyncProvider, nameof(asyncProvider));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(dateTimeProvider, nameof(dateTimeProvider));
            Guard.NotNull(dnsSettings, nameof(dnsSettings));
            Guard.NotNull(dataFolders, nameof(dataFolders));

            this.udpClient        = client;
            this.masterFile       = masterFile;
            this.asyncProvider    = asyncProvider;
            this.nodeLifetime     = nodeLifetime;
            this.logger           = loggerFactory.CreateLogger(this.GetType().FullName);
            this.dateTimeProvider = dateTimeProvider;
            this.dnsSettings      = dnsSettings;
            this.dataFolders      = dataFolders;
            this.metrics          = new DnsMetric();
        }
        public FederationWalletSyncManager(ILoggerFactory loggerFactory, IFederationWalletManager walletManager, ChainIndexer chain,
                                           Network network, IBlockStore blockStore, StoreSettings storeSettings, INodeLifetime nodeLifetime, IAsyncProvider asyncProvider)
        {
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(walletManager, nameof(walletManager));
            Guard.NotNull(chain, nameof(chain));
            Guard.NotNull(network, nameof(network));
            Guard.NotNull(blockStore, nameof(blockStore));
            Guard.NotNull(storeSettings, nameof(storeSettings));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));
            Guard.NotNull(asyncProvider, nameof(asyncProvider));

            this.walletManager       = walletManager;
            this.chain               = chain;
            this.blockStore          = blockStore;
            this.coinType            = (CoinType)network.Consensus.CoinType;
            this.storeSettings       = storeSettings;
            this.nodeLifetime        = nodeLifetime;
            this.asyncProvider       = asyncProvider;
            this.logger              = loggerFactory.CreateLogger(this.GetType().FullName);
            this.blockQueueProcessor = new BlockQueueProcessor(this.logger, this.asyncProvider, this.OnProcessBlockWrapperAsync, MaxQueueSize, nameof(FederationWalletSyncManager));
        }
 public LightWalletSyncManagerOverride(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain,
                                       Network network, IBlockNotification blockNotification, ISignals signals, INodeLifetime nodeLifetime, IAsyncLoopFactory asyncLoopFactory)
     : base(loggerFactory, walletManager, chain, network, blockNotification, signals, nodeLifetime, asyncLoopFactory)
 {
 }
Ejemplo n.º 4
0
 public IndexStoreSignaled(IndexStoreLoop storeLoop, ConcurrentChain chain, IndexSettings indexSettings,
                           ChainState chainState, IConnectionManager connection,
                           INodeLifetime nodeLifetime, IAsyncLoopFactory asyncLoopFactory, IIndexRepository indexRepository, ILoggerFactory loggerFactory) :
     base(storeLoop, chain, indexSettings, chainState, connection, nodeLifetime, asyncLoopFactory, indexRepository, loggerFactory, "IndexStore")
 {
 }
Ejemplo n.º 5
0
 public LightWalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain, Network network,
                               BlockNotification blockNotification, Signals signals, INodeLifetime nodeLifetime)
 {
     this.walletManager     = walletManager as WalletManager;
     this.chain             = chain;
     this.signals           = signals;
     this.blockNotification = blockNotification;
     this.coinType          = (CoinType)network.Consensus.CoinType;
     this.logger            = loggerFactory.CreateLogger(this.GetType().FullName);
     this.nodeLifetime      = nodeLifetime;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Class instance constructor.
        /// </summary>
        /// <param name="asyncProvider">See <see cref="IAsyncProvider"/>.</param>
        /// <param name="signals">See <see cref="ISignals"/>.</param>
        /// <param name="diagnosticSettings">See <see cref="DiagnosticSettings"/>.</param>
        /// <param name="nodeLifetime">See <see cref="INodeLifetime"/>.</param>
        public PeerStatisticsCollector(IAsyncProvider asyncProvider, ISignals signals, DiagnosticSettings diagnosticSettings, INodeLifetime nodeLifetime)
        {
            this.asyncProvider      = asyncProvider;
            this.signals            = Guard.NotNull(signals, nameof(signals));
            this.nodeLifetime       = nodeLifetime;
            this.diagnosticSettings = Guard.NotNull(diagnosticSettings, nameof(diagnosticSettings));

            this.eventSubscriptions = new List <SubscriptionToken>();
            this.peersStatistics    = new Dictionary <IPEndPoint, PeerStatistics>();

            this.lockStartStopCollecting = new object();
        }
Ejemplo n.º 7
0
        public InteropPoller(NodeSettings nodeSettings, InteropSettings interopSettings, IAsyncProvider asyncProvider, INodeLifetime nodeLifetime,
                             ChainIndexer chainIndexer, IInitialBlockDownloadState initialBlockDownloadState, IFederationManager federationManager, IFederationHistory federationHistory,
                             IFederatedPegBroadcaster federatedPegBroadcaster, IConversionRequestRepository conversionRequestRepository, IInteropTransactionManager interopTransactionManager,
                             CounterChainNetworkWrapper counterChainNetworkWrapper, IETHCompatibleClientProvider clientProvider)
        {
            this.interopSettings             = interopSettings;
            this.clientProvider              = clientProvider;
            this.network                     = nodeSettings.Network;
            this.asyncProvider               = asyncProvider;
            this.nodeLifetime                = nodeLifetime;
            this.chainIndexer                = chainIndexer;
            this.initialBlockDownloadState   = initialBlockDownloadState;
            this.federationManager           = federationManager;
            this.federationHistory           = federationHistory;
            this.federatedPegBroadcaster     = federatedPegBroadcaster;
            this.conversionRequestRepository = conversionRequestRepository;
            this.interopTransactionManager   = interopTransactionManager;
            this.counterChainNetwork         = counterChainNetworkWrapper.CounterChainNetwork;
            this.logger = nodeSettings.LoggerFactory.CreateLogger(this.GetType().FullName);

            this.eventFilterCreationRequired = new Dictionary <DestinationChain, bool>()
            {
                { DestinationChain.ETH, true }
            };
        }
Ejemplo n.º 8
0
 public WalletSyncManagerOverride(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain,
                                  Network network, IBlockStore blockStore, StoreSettings storeSettings, INodeLifetime nodeLifetime)
     : base(loggerFactory, walletManager, chain, network, blockStore, storeSettings, nodeLifetime)
 {
 }
Ejemplo n.º 9
0
 public CollateralPoAMiner(IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, Network network, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory,
                           IInitialBlockDownloadState ibdState, BlockDefinition blockDefinition, ISlotsManager slotsManager, IConnectionManager connectionManager,
                           PoABlockHeaderValidator poaHeaderValidator, IFederationManager federationManager, IIntegrityValidator integrityValidator, IWalletManager walletManager,
                           INodeStats nodeStats, VotingManager votingManager, PoAMinerSettings poAMinerSettings, ICollateralChecker collateralChecker, IAsyncProvider asyncProvider)
     : base(consensusManager, dateTimeProvider, network, nodeLifetime, loggerFactory, ibdState, blockDefinition, slotsManager, connectionManager,
            poaHeaderValidator, federationManager, integrityValidator, walletManager, nodeStats, votingManager, poAMinerSettings, asyncProvider)
 {
     this.collateralChecker = collateralChecker;
     this.encoder           = new CollateralHeightCommitmentEncoder();
 }
Ejemplo n.º 10
0
 public LightWalletFeature(IWalletSyncManager walletSyncManager, IWalletManager walletManager, IConnectionManager connectionManager,
                           ConcurrentChain chain, NodeDeployments nodeDeployments, IAsyncLoopFactory asyncLoopFactory, INodeLifetime nodeLifetime)
 {
     this.walletSyncManager = walletSyncManager;
     this.walletManager     = walletManager;
     this.connectionManager = connectionManager;
     this.chain             = chain;
     this.nodeDeployments   = nodeDeployments;
     this.asyncLoopFactory  = asyncLoopFactory;
     this.nodeLifetime      = nodeLifetime;
 }
Ejemplo n.º 11
0
        public WalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ChainIndexer chainIndexer,
                                 Network network, IBlockStore blockStore, StoreSettings storeSettings, ISignals signals, IAsyncProvider asyncProvider, INodeLifetime nodeLifetime,
                                 MempoolManager mempoolManager = null)
        {
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(walletManager, nameof(walletManager));
            Guard.NotNull(chainIndexer, nameof(chainIndexer));
            Guard.NotNull(network, nameof(network));
            Guard.NotNull(blockStore, nameof(blockStore));
            Guard.NotNull(storeSettings, nameof(storeSettings));
            Guard.NotNull(signals, nameof(signals));
            Guard.NotNull(asyncProvider, nameof(asyncProvider));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));

            this.mempoolManager        = mempoolManager;
            this.walletManager         = walletManager;
            this.chainIndexer          = chainIndexer;
            this.blockStore            = blockStore;
            this.storeSettings         = storeSettings;
            this.signals               = signals;
            this.asyncProvider         = asyncProvider;
            this.logger                = loggerFactory.CreateLogger(this.GetType().FullName);
            this.nodeLifetime          = nodeLifetime;
            this.syncCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(this.nodeLifetime.ApplicationStopping);
            this.lockObject            = new object();
        }
        public WalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain,
                                 Network network, IBlockStore blockStore, StoreSettings storeSettings, INodeLifetime nodeLifetime)
        {
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(walletManager, nameof(walletManager));
            Guard.NotNull(chain, nameof(chain));
            Guard.NotNull(network, nameof(network));
            Guard.NotNull(blockStore, nameof(blockStore));
            Guard.NotNull(storeSettings, nameof(storeSettings));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));

            this.walletManager = walletManager;
            this.chain         = chain;
            this.blockStore    = blockStore;
            this.storeSettings = storeSettings;
            this.nodeLifetime  = nodeLifetime;
            this.logger        = loggerFactory.CreateLogger(this.GetType().FullName);
            this.blocksQueue   = new AsyncQueue <Block>(this.OnProcessBlockAsync);

            this.blocksQueueSize = 0;
        }
Ejemplo n.º 13
0
 public ConnectionManager(Network network, NodeConnectionParameters parameters, NodeSettings nodeSettings, ILoggerFactory loggerFactory, INodeLifetime nodeLifetime)
 {
     this.network      = network;
     this.nodeSettings = nodeSettings;
     this.nodeLifetime = nodeLifetime;
     this.connectionManagerSettings = nodeSettings.ConnectionManager;
     this.parameters = parameters;
     this.parameters.ConnectCancellation = this.nodeLifetime.ApplicationStopping;
     this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DnsFeature"/> class.
        /// </summary>
        /// <param name="dnsServer">The DNS server.</param>
        /// <param name="whitelistManager">The whitelist manager.</param>
        /// <param name="loggerFactory">The factory to create the logger.</param>
        /// <param name="nodeLifetime">The node lifetime object used for graceful shutdown.</param>
        /// <param name="nodeSettings">The node settings object containing node configuration.</param>
        /// <param name="dnsSettings">Defines the DNS settings for the node</param>
        /// <param name="dataFolders">The data folders of the system.</param>
        /// <param name="asyncProvider">The asynchronous loop factory.</param>
        /// <param name="connectionManager">Manager of node's network connections.</param>
        /// <param name="unreliablePeerBehavior">Instance of the UnreliablePeerBehavior that will be added to the connectionManager Template.</param>
        public DnsFeature(IDnsServer dnsServer, IWhitelistManager whitelistManager, ILoggerFactory loggerFactory, INodeLifetime nodeLifetime, DnsSettings dnsSettings, NodeSettings nodeSettings, DataFolder dataFolders, IAsyncProvider asyncProvider, IConnectionManager connectionManager, UnreliablePeerBehavior unreliablePeerBehavior)
        {
            Guard.NotNull(dnsServer, nameof(dnsServer));
            Guard.NotNull(whitelistManager, nameof(whitelistManager));
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));
            Guard.NotNull(nodeSettings, nameof(nodeSettings));
            Guard.NotNull(dataFolders, nameof(dataFolders));
            Guard.NotNull(asyncProvider, nameof(asyncProvider));
            Guard.NotNull(connectionManager, nameof(connectionManager));
            Guard.NotNull(unreliablePeerBehavior, nameof(unreliablePeerBehavior));

            this.dnsServer              = dnsServer;
            this.whitelistManager       = whitelistManager;
            this.logger                 = loggerFactory.CreateLogger(this.GetType().FullName);
            this.asyncProvider          = asyncProvider;
            this.nodeLifetime           = nodeLifetime;
            this.nodeSettings           = nodeSettings;
            this.dnsSettings            = dnsSettings;
            this.dataFolders            = dataFolders;
            this.connectionManager      = connectionManager;
            this.unreliablePeerBehavior = unreliablePeerBehavior;
        }
 public LightWalletBitcoinExternalFeePolicy(IAsyncLoopFactory asyncLoopFactory, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, NodeSettings settings)
 {
     this.asyncLoopFactory = asyncLoopFactory;
     this.nodeLifetime     = nodeLifetime;
     this.logger           = loggerFactory.CreateLogger("Impleum.Bitcoin.FullNode");
     this.nodeSettings     = settings;
     this.maxTxFee         = new Money(0.1M, MoneyUnit.BTC);
     this.initializedOnce  = false;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Initializes the cross-chain transfer tests.
        /// </summary>
        /// <param name="network">The network to run the tests for.</param>
        public CrossChainTestBase(Network network = null, Network counterChainNetwork = null)
        {
            this.network                    = network ?? CirrusNetwork.NetworksSelector.Regtest();
            this.counterChainNetwork        = counterChainNetwork ?? Networks.Stratis.Regtest();
            this.counterChainNetworkWrapper = new CounterChainNetworkWrapper(counterChainNetwork);

            NetworkRegistration.Register(this.network);

            this.loggerFactory = Substitute.For <ILoggerFactory>();
            this.nodeLifetime  = new NodeLifetime();
            this.logger        = Substitute.For <ILogger>();
            this.signals       = Substitute.For <ISignals>();
            this.asyncProvider = new AsyncProvider(this.loggerFactory, this.signals, this.nodeLifetime);
            this.loggerFactory.CreateLogger(null).ReturnsForAnyArgs(this.logger);
            this.dateTimeProvider                   = DateTimeProvider.Default;
            this.opReturnDataReader                 = new OpReturnDataReader(this.loggerFactory, this.counterChainNetworkWrapper);
            this.blockRepository                    = Substitute.For <IBlockRepository>();
            this.fullNode                           = Substitute.For <IFullNode>();
            this.withdrawalTransactionBuilder       = Substitute.For <IWithdrawalTransactionBuilder>();
            this.federationWalletManager            = Substitute.For <IFederationWalletManager>();
            this.federationWalletSyncManager        = Substitute.For <IFederationWalletSyncManager>();
            this.FederationWalletTransactionHandler = Substitute.For <IFederationWalletTransactionHandler>();
            this.walletFeePolicy                    = Substitute.For <IWalletFeePolicy>();
            this.connectionManager                  = Substitute.For <IConnectionManager>();
            this.dBreezeSerializer                  = new DBreezeSerializer(this.network.Consensus.ConsensusFactory);
            this.ibdState                           = Substitute.For <IInitialBlockDownloadState>();
            this.wallet = null;
            this.federatedPegSettings = Substitute.For <IFederatedPegSettings>();
            this.ChainIndexer         = new ChainIndexer(this.network);
            this.federatedPegSettings.GetWithdrawalTransactionFee(Arg.Any <int>()).ReturnsForAnyArgs((x) =>
            {
                int numInputs = x.ArgAt <int>(0);

                return(FederatedPegSettings.BaseTransactionFee + FederatedPegSettings.InputTransactionFee * numInputs);
            });

            // Generate the keys used by the federation members for our tests.
            this.federationKeys = new[]
            {
                "ensure feel swift crucial bridge charge cloud tell hobby twenty people mandate",
                "quiz sunset vote alley draw turkey hill scrap lumber game differ fiction",
                "exchange rent bronze pole post hurry oppose drama eternal voice client state"
            }.Select(m => HdOperations.GetExtendedKey(m)).ToArray();

            SetExtendedKey(0);

            this.fundingTransactions = new List <Transaction>();

            this.blockDict = new Dictionary <uint256, Block>();
            this.blockDict[this.network.GenesisHash] = this.network.GetGenesis();

            this.blockRepository.GetBlocks(Arg.Any <List <uint256> >()).ReturnsForAnyArgs((x) =>
            {
                List <uint256> hashes = x.ArgAt <List <uint256> >(0);
                var blocks            = new List <Block>();
                for (int i = 0; i < hashes.Count; i++)
                {
                    blocks.Add(this.blockDict.TryGetValue(hashes[i], out Block block) ? block : null);
                }

                return(blocks);
            });

            this.blockRepository.GetBlock(Arg.Any <uint256>()).ReturnsForAnyArgs((x) =>
            {
                uint256 hash = x.ArgAt <uint256>(0);
                this.blockDict.TryGetValue(hash, out Block block);

                return(block);
            });

            this.blockRepository.TipHashAndHeight.Returns((x) => {
                return(new HashHeightPair(this.blockDict.Last().Value.GetHash(), this.blockDict.Count - 1));
            });
        }
Ejemplo n.º 17
0
        public WalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain,
                                 Network network, IBlockStoreCache blockStoreCache, StoreSettings storeSettings, INodeLifetime nodeLifetime)
        {
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(walletManager, nameof(walletManager));
            Guard.NotNull(chain, nameof(chain));
            Guard.NotNull(network, nameof(network));
            Guard.NotNull(blockStoreCache, nameof(blockStoreCache));
            Guard.NotNull(storeSettings, nameof(storeSettings));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));

            this.walletManager   = walletManager;
            this.chain           = chain;
            this.blockStoreCache = blockStoreCache;
            this.coinType        = (CoinType)network.Consensus.CoinType;
            this.storeSettings   = storeSettings;
            this.nodeLifetime    = nodeLifetime;
            this.logger          = loggerFactory.CreateLogger(this.GetType().FullName);
        }
        public TestContext()
        {
            this.Network = KnownNetworks.RegTest;

            this.chain            = new ConcurrentChain(this.Network);
            this.dateTimeProvider = new DateTimeProvider();
            this.hashStore        = new InvalidBlockHashStore(this.dateTimeProvider);

            this.coinView        = new TestInMemoryCoinView(this.chain.Tip.HashBlock);
            this.HeaderValidator = new Mock <IHeaderValidator>();
            this.HeaderValidator.Setup(hv => hv.ValidateHeader(It.IsAny <ChainedHeader>())).Returns(new ValidationContext());

            this.nodeLifetime = new NodeLifetime();
            this.ibd          = new Mock <IInitialBlockDownloadState>();
            this.BlockPuller  = new Mock <IBlockPuller>();

            this.BlockPuller.Setup(b => b.Initialize(It.IsAny <BlockPuller.OnBlockDownloadedCallback>()))
            .Callback <BlockPuller.OnBlockDownloadedCallback>((d) => { this.blockPullerBlockDownloadCallback = d; });
            this.BlockStore  = new Mock <IBlockStore>();
            this.checkpoints = new Mock <ICheckpoints>();
            this.ChainState  = new Mock <IChainState>();
            this.nodeStats   = new NodeStats(this.dateTimeProvider);


            string[] param = new string[] { };
            this.nodeSettings      = new NodeSettings(this.Network, args: param);
            this.ConsensusSettings = new ConsensusSettings(this.nodeSettings);

            this.loggerFactory = this.nodeSettings.LoggerFactory;

            var connectionSettings = new ConnectionManagerSettings(this.nodeSettings);

            this.selfEndpointTracker       = new SelfEndpointTracker(this.loggerFactory, connectionSettings);
            this.Network.Consensus.Options = new ConsensusOptions();

            this.ruleRegistration = new FullNodeBuilderConsensusExtension.PowConsensusRulesRegistration();
            this.ruleRegistration.RegisterRules(this.Network.Consensus);

            // Dont check PoW of a header in this test.
            this.Network.Consensus.HeaderValidationRules.RemoveAll(x => x.GetType() == typeof(CheckDifficultyPowRule));

            this.ChainedHeaderTree = new ChainedHeaderTree(
                this.Network,
                this.loggerFactory,
                this.HeaderValidator.Object,
                this.checkpoints.Object,
                this.ChainState.Object,
                this.FinalizedBlockMock.Object,
                this.ConsensusSettings,
                this.hashStore);

            this.networkPeerFactory = new NetworkPeerFactory(this.Network,
                                                             this.dateTimeProvider,
                                                             this.loggerFactory, new PayloadProvider().DiscoverPayloads(),
                                                             this.selfEndpointTracker,
                                                             this.ibd.Object,
                                                             new ConnectionManagerSettings(this.nodeSettings));

            this.peerAddressManager = new PeerAddressManager(DateTimeProvider.Default, this.nodeSettings.DataFolder, this.loggerFactory, this.selfEndpointTracker);
            var peerDiscovery = new PeerDiscovery(new AsyncLoopFactory(this.loggerFactory), this.loggerFactory, this.Network, this.networkPeerFactory, this.nodeLifetime, this.nodeSettings, this.peerAddressManager);

            this.connectionManager = new ConnectionManager(this.dateTimeProvider, this.loggerFactory, this.Network, this.networkPeerFactory, this.nodeSettings,
                                                           this.nodeLifetime, new NetworkPeerConnectionParameters(), this.peerAddressManager, new IPeerConnector[] { },
                                                           peerDiscovery, this.selfEndpointTracker, connectionSettings, new VersionProvider(), this.nodeStats);

            this.deployments = new NodeDeployments(this.Network, this.chain);

            this.consensusRules = new PowConsensusRuleEngine(this.Network, this.loggerFactory, this.dateTimeProvider, this.chain, this.deployments, this.ConsensusSettings,
                                                             this.checkpoints.Object, this.coinView, this.ChainState.Object, this.hashStore, this.nodeStats);

            this.consensusRules.Register();

            var tree = new ChainedHeaderTree(this.Network, this.loggerFactory, this.HeaderValidator.Object, this.checkpoints.Object,
                                             this.ChainState.Object, this.FinalizedBlockMock.Object, this.ConsensusSettings, this.hashStore);

            this.PartialValidator = new Mock <IPartialValidator>();
            this.FullValidator    = new Mock <IFullValidator>();


            this.peerBanning = new PeerBanning(this.connectionManager, this.loggerFactory, this.dateTimeProvider, this.peerAddressManager);

            this.IntegrityValidator.Setup(i => i.VerifyBlockIntegrity(It.IsAny <ChainedHeader>(), It.IsAny <Block>()))
            .Returns(new ValidationContext());

            ConsensusManager consensusManager = new ConsensusManager(tree, this.Network, this.loggerFactory, this.ChainState.Object, this.IntegrityValidator.Object,
                                                                     this.PartialValidator.Object, this.FullValidator.Object, this.consensusRules,
                                                                     this.FinalizedBlockMock.Object, new Stratis.Bitcoin.Signals.Signals(this.loggerFactory, null), this.peerBanning, this.ibd.Object, this.chain,
                                                                     this.BlockPuller.Object, this.BlockStore.Object, this.connectionManager, this.nodeStats, this.nodeLifetime, this.ConsensusSettings);

            this.TestConsensusManager = new TestConsensusManager(consensusManager);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DnsFeature"/> class.
        /// </summary>
        /// <param name="dnsServer">The DNS server.</param>
        /// <param name="whitelistManager">The whitelist manager.</param>
        /// <param name="loggerFactory">The factory to create the logger.</param>
        /// <param name="nodeLifetime">The node lifetime object used for graceful shutdown.</param>
        /// <param name="nodeSettings">The node settings object containing node configuration.</param>
        /// <param name="dataFolders">The data folders of the system.</param>
        /// <param name="asyncLoopFactory">The asynchronous loop factory.</param>
        public DnsFeature(IDnsServer dnsServer, IWhitelistManager whitelistManager, ILoggerFactory loggerFactory, INodeLifetime nodeLifetime, DnsSettings dnsSettings, NodeSettings nodeSettings, DataFolder dataFolders, IAsyncLoopFactory asyncLoopFactory)
        {
            Guard.NotNull(dnsServer, nameof(dnsServer));
            Guard.NotNull(whitelistManager, nameof(whitelistManager));
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));
            Guard.NotNull(nodeSettings, nameof(nodeSettings));
            Guard.NotNull(dataFolders, nameof(dataFolders));
            Guard.NotNull(asyncLoopFactory, nameof(asyncLoopFactory));

            this.dnsServer        = dnsServer;
            this.whitelistManager = whitelistManager;
            this.logger           = loggerFactory.CreateLogger(this.GetType().FullName);
            this.asyncLoopFactory = asyncLoopFactory;
            this.nodeLifetime     = nodeLifetime;
            this.nodeSettings     = nodeSettings;
            this.dnsSettings      = dnsSettings;
            this.dataFolders      = dataFolders;
        }
Ejemplo n.º 20
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, 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, 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;
 }