public BlockStoreFeature( ConcurrentChain chain, IConnectionManager connectionManager, Signals.Signals signals, IBlockRepository blockRepository, IBlockStoreCache blockStoreCache, StoreBlockPuller blockPuller, BlockStoreLoop blockStoreLoop, BlockStoreManager blockStoreManager, BlockStoreSignaled blockStoreSignaled, INodeLifetime nodeLifetime, NodeSettings nodeSettings, ILoggerFactory loggerFactory, StoreSettings storeSettings, string name = "BlockStore") { this.name = name; this.chain = chain; this.signals = signals; this.blockRepository = blockRepository; this.blockStoreCache = blockStoreCache; this.blockPuller = blockPuller; this.blockStoreLoop = blockStoreLoop; this.blockStoreManager = blockStoreManager; this.blockStoreSignaled = blockStoreSignaled; this.nodeLifetime = nodeLifetime; this.connectionManager = connectionManager; this.nodeSettings = nodeSettings; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.loggerFactory = loggerFactory; storeSettings.Load(nodeSettings); this.storeSettings = storeSettings; }
/// <summary> /// Public constructor for unit testing /// </summary> public BlockStoreLoop(IAsyncLoopFactory asyncLoopFactory, StoreBlockPuller blockPuller, BlockRepository blockRepository, BlockStoreCache cache, ConcurrentChain chain, ChainState chainState, NodeSettings nodeArgs, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, string name = "BlockStore") { this.name = name; this.asyncLoopFactory = asyncLoopFactory; this.BlockPuller = blockPuller; this.BlockRepository = blockRepository; this.Chain = chain; this.ChainState = chainState; this.blockStoreCache = cache; this.nodeLifetime = nodeLifetime; this.nodeArgs = nodeArgs; this.storeLogger = loggerFactory.CreateLogger(GetType().FullName); this.PendingStorage = new ConcurrentDictionary <uint256, BlockPair>(); this.blockStoreStats = new BlockStoreStats(this.BlockRepository, this.blockStoreCache, this.storeLogger); }
/// <summary>Public constructor for unit testing</summary> public BlockStoreLoop(IAsyncLoopFactory asyncLoopFactory, StoreBlockPuller blockPuller, IBlockRepository blockRepository, IBlockStoreCache cache, ConcurrentChain chain, ChainState chainState, StoreSettings storeSettings, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, IDateTimeProvider dateTimeProvider) { this.asyncLoopFactory = asyncLoopFactory; this.BlockPuller = blockPuller; this.BlockRepository = blockRepository; this.Chain = chain; this.ChainState = chainState; this.nodeLifetime = nodeLifetime; this.storeSettings = storeSettings; this.logger = loggerFactory.CreateLogger(GetType().FullName); this.loggerFactory = loggerFactory; this.dateTimeProvider = dateTimeProvider; this.PendingStorage = new ConcurrentDictionary <uint256, BlockPair>(); this.blockStoreStats = new BlockStoreStats(this.BlockRepository, cache, this.dateTimeProvider, this.logger); }
internal BlockStoreLoop CreateBlockStoreLoop(ConcurrentChain chain, BlockRepository blockRepository, string testFolder) { ConfigureLogger(); Mock <IConnectionManager> connectionManager = ConfigureConnectionManager(); var blockPuller = new StoreBlockPuller(chain, connectionManager.Object, this.loggerFactory.Object); FullNode fullNode = new Mock <FullNode>().Object; fullNode.DateTimeProvider = new DateTimeProvider(); var chainState = new Mock <ChainState>(fullNode); chainState.Object.SetIsInitialBlockDownload(false, DateTime.Today); IAsyncLoopFactory asyncLoopFactory = new Mock <IAsyncLoopFactory>().Object; INodeLifetime nodeLifeTime = new Mock <INodeLifetime>().Object; var blockStoreLoop = new BlockStoreLoop( asyncLoopFactory, blockPuller, blockRepository, null, chain, chainState.Object, NodeSettings.FromArguments(new string[] { string.Format("-datadir={0}", testFolder) }), nodeLifeTime, this.loggerFactory.Object); return(blockStoreLoop); }
public BlockStoreLoop(ConcurrentChain chain, BlockRepository blockRepository, NodeSettings nodeArgs, BlockStore.ChainBehavior.ChainState chainState, StoreBlockPuller blockPuller) { this.chain = chain; this.BlockRepository = blockRepository; this.nodeArgs = nodeArgs; this.blockPuller = blockPuller; this.ChainState = chainState; PendingStorage = new ConcurrentDictionary <uint256, BlockPair>(); }
public BlockStoreFeature(ConcurrentChain chain, ConnectionManager connectionManager, Signals signals, BlockRepository blockRepository, BlockStoreCache blockStoreCache, StoreBlockPuller blockPuller, BlockStoreLoop blockStoreLoop, BlockStoreManager blockStoreManager, BlockStoreSignaled blockStoreSignaled, FullNode.CancellationProvider cancellationProvider) { this.chain = chain; this.signals = signals; this.blockRepository = blockRepository; this.blockStoreCache = blockStoreCache; this.blockPuller = blockPuller; this.blockStoreLoop = blockStoreLoop; this.blockStoreManager = blockStoreManager; this.blockStoreSignaled = blockStoreSignaled; this.cancellationProvider = cancellationProvider; this.connectionManager = connectionManager; }
public BlockStoreFeature(ConcurrentChain chain, IConnectionManager connectionManager, Signals signals, BlockRepository blockRepository, BlockStoreCache blockStoreCache, StoreBlockPuller blockPuller, BlockStoreLoop blockStoreLoop, BlockStoreManager blockStoreManager, BlockStoreSignaled blockStoreSignaled, INodeLifetime nodeLifetime, NodeSettings nodeSettings) { this.chain = chain; this.signals = signals; this.blockRepository = blockRepository; this.blockStoreCache = blockStoreCache; this.blockPuller = blockPuller; this.blockStoreLoop = blockStoreLoop; this.blockStoreManager = blockStoreManager; this.blockStoreSignaled = blockStoreSignaled; this.nodeLifetime = nodeLifetime; this.connectionManager = connectionManager; this.nodeSettings = nodeSettings; }
public BlockStoreLoop(ConcurrentChain chain, BlockRepository blockRepository, NodeSettings nodeArgs, BlockStore.ChainBehavior.ChainState chainState, StoreBlockPuller blockPuller, BlockStoreCache cache, INodeLifetime nodeLifetime, IAsyncLoopFactory asyncLoopFactory) { this.chain = chain; this.BlockRepository = blockRepository; this.nodeArgs = nodeArgs; this.blockPuller = blockPuller; this.ChainState = chainState; this.blockStoreCache = cache; this.nodeLifetime = nodeLifetime; this.asyncLoopFactory = asyncLoopFactory; this.PendingStorage = new ConcurrentDictionary <uint256, BlockPair>(); this.blockStoreStats = new BlockStoreStats(this.BlockRepository, this.blockStoreCache); }
internal void Create(ConcurrentChain chain) { this.blockPuller = new StoreBlockPuller(chain, this.connectionManager.Object, this.loggerFactory.Object); if (this.asyncLoopFactory == null) { this.asyncLoopFactory = new Mock <IAsyncLoopFactory>().Object; } this.Loop = new BlockStoreLoop( this.asyncLoopFactory, this.blockPuller, this.BlockRepository, null, chain, this.chainState.Object, new StoreSettings(NodeSettings.FromArguments(new string[] { $"-datadir={this.dataFolder.WalletPath}" })), this.nodeLifeTime.Object, this.loggerFactory.Object, DateTimeProvider.Default); }