Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the object.
 /// </summary>
 /// <param name="nodeSettings">User defined node settings.</param>
 /// <param name="dataFolder">Locations of important folders and files on disk.</param>
 /// <param name="network">Specification of the network the node runs on - regtest/testnet/mainnet.</param>
 /// <param name="nodeLifetime">Global application life cycle control - triggers when application shuts down.</param>
 /// <param name="chain">Thread safe chain of block headers from genesis.</param>
 /// <param name="chainState">Information about node's chain.</param>
 /// <param name="connectionManager">Manager of node's network connections.</param>
 /// <param name="chainRepository">Access to the database of blocks.</param>
 /// <param name="dateTimeProvider">Provider of time functions.</param>
 /// <param name="asyncLoopFactory">Factory for creating background async loop tasks.</param>
 /// <param name="timeSyncBehaviorState">State of time synchronization feature that stores collected data samples.</param>
 /// <param name="dbreezeSerializer">Provider of binary (de)serialization for data stored in the database.</param>
 /// <param name="loggerFactory">Factory to be used to create logger for the node.</param>
 public BaseFeature(
     NodeSettings nodeSettings,
     DataFolder dataFolder,
     Network network,
     INodeLifetime nodeLifetime,
     ConcurrentChain chain,
     ChainState chainState,
     IConnectionManager connectionManager,
     ChainRepository chainRepository,
     IDateTimeProvider dateTimeProvider,
     IAsyncLoopFactory asyncLoopFactory,
     TimeSyncBehaviorState timeSyncBehaviorState,
     DBreezeSerializer dbreezeSerializer,
     ILoggerFactory loggerFactory)
 {
     this.chainState            = Guard.NotNull(chainState, nameof(chainState));
     this.chainRepository       = Guard.NotNull(chainRepository, nameof(chainRepository));
     this.nodeSettings          = Guard.NotNull(nodeSettings, nameof(nodeSettings));
     this.dataFolder            = Guard.NotNull(dataFolder, nameof(dataFolder));
     this.network               = Guard.NotNull(network, nameof(network));
     this.nodeLifetime          = Guard.NotNull(nodeLifetime, nameof(nodeLifetime));
     this.chain                 = Guard.NotNull(chain, nameof(chain));
     this.connectionManager     = Guard.NotNull(connectionManager, nameof(connectionManager));
     this.dateTimeProvider      = dateTimeProvider;
     this.asyncLoopFactory      = asyncLoopFactory;
     this.timeSyncBehaviorState = timeSyncBehaviorState;
     this.loggerFactory         = loggerFactory;
     this.dbreezeSerializer     = dbreezeSerializer;
     this.logger                = loggerFactory.CreateLogger(this.GetType().FullName);
 }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the object.
        /// </summary>
        /// <param name="nodeSettings">User defined node settings.</param>
        /// <param name="dataFolder">Locations of important folders and files on disk.</param>
        /// <param name="nodeLifetime">Global application life cycle control - triggers when application shuts down.</param>
        /// <param name="chain">Thread safe access to the best chain of block headers (that the node is aware of) from genesis.</param>
        /// <param name="chainState">Information about node's chain.</param>
        /// <param name="connectionManager">Manager of node's network connections.</param>
        /// <param name="chainRepository">Access to the database of blocks.</param>
        /// <param name="dateTimeProvider">Provider of time functions.</param>
        /// <param name="asyncLoopFactory">Factory for creating background async loop tasks.</param>
        /// <param name="timeSyncBehaviorState">State of time synchronization feature that stores collected data samples.</param>
        /// <param name="dbreezeSerializer">Provider of binary (de)serialization for data stored in the database.</param>
        /// <param name="loggerFactory">Factory to be used to create logger for the node.</param>
        /// <param name="initialBlockDownloadState">Provider of IBD state.</param>
        public BaseFeature(
            NodeSettings nodeSettings,
            DataFolder dataFolder,
            INodeLifetime nodeLifetime,
            ConcurrentChain chain,
            IChainState chainState,
            IConnectionManager connectionManager,
            ChainRepository chainRepository,
            IDateTimeProvider dateTimeProvider,
            IAsyncLoopFactory asyncLoopFactory,
            TimeSyncBehaviorState timeSyncBehaviorState,
            DBreezeSerializer dbreezeSerializer,
            ILoggerFactory loggerFactory,
            IInitialBlockDownloadState initialBlockDownloadState,
            IPeerBanning peerBanning,
            IPeerAddressManager peerAddressManager)
        {
            this.chainState        = Guard.NotNull(chainState, nameof(chainState));
            this.chainRepository   = Guard.NotNull(chainRepository, nameof(chainRepository));
            this.nodeSettings      = Guard.NotNull(nodeSettings, nameof(nodeSettings));
            this.dataFolder        = Guard.NotNull(dataFolder, nameof(dataFolder));
            this.nodeLifetime      = Guard.NotNull(nodeLifetime, nameof(nodeLifetime));
            this.chain             = Guard.NotNull(chain, nameof(chain));
            this.connectionManager = Guard.NotNull(connectionManager, nameof(connectionManager));
            this.peerBanning       = Guard.NotNull(peerBanning, nameof(peerBanning));

            this.peerAddressManager = Guard.NotNull(peerAddressManager, nameof(peerAddressManager));
            this.peerAddressManager.PeerFilePath = this.dataFolder;

            this.initialBlockDownloadState = initialBlockDownloadState;
            this.dateTimeProvider          = dateTimeProvider;
            this.asyncLoopFactory          = asyncLoopFactory;
            this.timeSyncBehaviorState     = timeSyncBehaviorState;
            this.loggerFactory             = loggerFactory;
            this.dbreezeSerializer         = dbreezeSerializer;
            this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
        }