/// <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); }
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; }
public SmartContractsController(IBroadcasterManager broadcasterManager, IBlockStoreCache blockStoreCache, ConcurrentChain chain, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, Network network, IContractStateRoot stateRoot, IWalletManager walletManager, IWalletTransactionHandler walletTransactionHandler, IAddressGenerator addressGenerator, IContractPrimitiveSerializer contractPrimitiveSerializer, IReceiptRepository receiptRepository) { this.stateRoot = stateRoot; this.walletTransactionHandler = walletTransactionHandler; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.network = network; this.coinType = (CoinType)network.Consensus.CoinType; this.chain = chain; this.blockStoreCache = blockStoreCache; this.walletManager = walletManager; this.broadcasterManager = broadcasterManager; this.addressGenerator = addressGenerator; this.contractPrimitiveSerializer = contractPrimitiveSerializer; this.receiptRepository = receiptRepository; }
public BlockStoreStats(IBlockRepository blockRepository, IBlockStoreCache blockStoreCache, ILogger logger) { this.repository = blockRepository; this.cache = blockStoreCache as BlockStoreCache; this.logger = logger; this.lastRepositorySnapshot = this.repository?.PerformanceCounter.Snapshot(); this.lastCacheSnapshot = this.cache?.PerformanceCounter.Snapshot(); }
public BlockStoreBehavior( ConcurrentChain chain, BlockRepository blockRepository, IBlockStoreCache blockStoreCache, ILoggerFactory loggerFactory) : this(chain, blockRepository as IBlockRepository, blockStoreCache, loggerFactory) { }
public WalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain, Network network, IBlockStoreCache blockStoreCache, NodeSettings nodeSettings) { this.walletManager = walletManager as WalletManager; this.chain = chain; this.blockStoreCache = blockStoreCache; this.coinType = (CoinType)network.Consensus.CoinType; this.nodeSettings = nodeSettings; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }
public BlockStoreController(ILoggerFactory loggerFactory, IBlockStoreCache blockStoreCache, IChainState chainState) { Guard.NotNull(loggerFactory, nameof(loggerFactory)); Guard.NotNull(blockStoreCache, nameof(blockStoreCache)); Guard.NotNull(chainState, nameof(chainState)); this.blockStoreCache = blockStoreCache; this.chainState = chainState; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }
public BlockStoreBehavior(ConcurrentChain chain, IBlockRepository blockRepository, IBlockStoreCache blockStoreCache) { Guard.NotNull(chain, nameof(chain)); Guard.NotNull(blockRepository, nameof(blockRepository)); Guard.NotNull(blockStoreCache, nameof(blockStoreCache)); this.chain = chain; this.blockRepository = blockRepository; this.blockStoreCache = blockStoreCache; this.CanRespondToGetBlocksPayload = false; this.CanRespondeToGetDataPayload = true; this.PreferHeaders = false; this.preferHeaderAndIDs = false; }
public MockChainNode(CoreNode coreNode, MockChain chain) { this.CoreNode = coreNode; this.chain = chain; // Set up address and mining this.CoreNode.NotInIBD(); this.CoreNode.FullNode.WalletManager().CreateWallet(Password, WalletName); this.MinerAddress = this.CoreNode.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference(WalletName, AccountName)); Features.Wallet.Wallet wallet = this.CoreNode.FullNode.WalletManager().GetWalletByName(WalletName); Key key = wallet.GetExtendedPrivateKeyForAddress(Password, this.MinerAddress).PrivateKey; this.CoreNode.SetDummyMinerSecret(new BitcoinSecret(key, this.CoreNode.FullNode.Network)); // Set up services for later this.smartContractsController = this.CoreNode.FullNode.NodeService <SmartContractsController>(); this.stateRoot = this.CoreNode.FullNode.NodeService <ContractStateRepositoryRoot>(); this.blockStore = this.CoreNode.FullNode.NodeService <IBlockStoreCache>(); }
public BlockStoreBehavior(ConcurrentChain chain, IBlockRepository blockRepository, IBlockStoreCache blockStoreCache, ILoggerFactory loggerFactory) { Guard.NotNull(chain, nameof(chain)); Guard.NotNull(blockRepository, nameof(blockRepository)); Guard.NotNull(blockStoreCache, nameof(blockStoreCache)); Guard.NotNull(loggerFactory, nameof(loggerFactory)); this.chain = chain; this.blockRepository = blockRepository; this.blockStoreCache = blockStoreCache; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.loggerFactory = loggerFactory; this.CanRespondToGetBlocksPayload = true; this.CanRespondToGetDataPayload = true; this.PreferHeaders = false; this.preferHeaderAndIDs = false; }
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 BlockStoreSignaled( BlockStoreLoop blockStoreLoop, ConcurrentChain chain, StoreSettings storeSettings, IChainState chainState, IConnectionManager connection, INodeLifetime nodeLifetime, ILoggerFactory loggerFactory, IBlockStoreCache blockStoreCache) { this.blockStoreLoop = blockStoreLoop; this.chain = chain; this.chainState = chainState; this.connection = connection; this.nodeLifetime = nodeLifetime; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.storeSettings = storeSettings; this.blockStoreCache = blockStoreCache; this.blocksToAnnounce = new AsyncQueue <ChainedHeader>(); this.dequeueLoopTask = this.DequeueContinuouslyAsync(); }
public BlockStoreSignaled( BlockStoreLoop blockStoreLoop, ConcurrentChain chain, StoreSettings storeSettings, ChainState chainState, IConnectionManager connection, INodeLifetime nodeLifetime, IAsyncLoopFactory asyncLoopFactory, ILoggerFactory loggerFactory, IBlockStoreCache blockStoreCache, string name = "BlockStore") { this.asyncLoopFactory = asyncLoopFactory; this.blocksToAnnounce = new ConcurrentQueue <ChainedBlock>(); this.blockStoreLoop = blockStoreLoop; this.chain = chain; this.chainState = chainState; this.connection = connection; this.name = name; this.nodeLifetime = nodeLifetime; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.storeSettings = storeSettings; this.blockStoreCache = blockStoreCache; }
public WalletSyncManagerOverride(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain, Network network, IBlockStoreCache blockStoreCache, StoreSettings storeSettings, INodeLifetime nodeLifetime) : base(loggerFactory, walletManager, chain, network, blockStoreCache, storeSettings, nodeLifetime) { }
public BlockStoreController(ILoggerFactory loggerFactory, IBlockStoreCache blockStoreCache) { this.blockStoreCache = blockStoreCache; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }