Ejemplo n.º 1
0
 public TransactionsRegistrySyncHandler(IStatesRepository statesRepository, ISyncShardsManager syncShardsManager, IIdentityKeyProvidersRegistry identityKeyProvidersRegistry,
                                        ISerializersFactory serializersFactory, IHashCalculationsRepository hashCalculationsRepository,
                                        IServerCommunicationServicesRegistry communicationServicesRegistry, ISyncRegistryMemPool syncRegistryMemPool, INodesResolutionService nodesResolutionService,
                                        IChainDataServicesManager chainDataServicesManager, IRawPacketProvidersFactory rawPacketProvidersFactory, IConfigurationService configurationService, ILoggerService loggerService)
 {
     _configurationService          = configurationService;
     _registryBlocks                = new BlockingCollection <RegistryBlockBase>();
     _synchronizationContext        = statesRepository.GetInstance <ISynchronizationContext>();
     _syncRegistryNeighborhoodState = statesRepository.GetInstance <ISyncRegistryNeighborhoodState>();
     _nodeContext = statesRepository.GetInstance <INodeContext>();
     _syncContextChangedUnsibsciber     = _synchronizationContext.SubscribeOnStateChange(new ActionBlock <string>((Action <string>)SynchronizationStateChanged));
     _syncShardsManager                 = syncShardsManager;
     _transactionHashKey                = identityKeyProvidersRegistry.GetTransactionsIdenityKeyProvider();
     _serializersFactory                = serializersFactory;
     _defaultTransactionHashCalculation = hashCalculationsRepository.Create(Globals.DEFAULT_HASH);
     _powCalculation = hashCalculationsRepository.Create(Globals.POW_TYPE);
     _communicationServicesRegistry   = communicationServicesRegistry;
     _syncRegistryMemPool             = syncRegistryMemPool;
     _nodesResolutionService          = nodesResolutionService;
     _rawPacketProvidersFactory       = rawPacketProvidersFactory;
     _synchronizationChainDataService = chainDataServicesManager.GetChainDataService(PacketType.Synchronization);
     _registryChainDataService        = chainDataServicesManager.GetChainDataService(PacketType.Registry);
     _logger = loggerService.GetLogger(nameof(TransactionsRegistrySyncHandler));
 }
Ejemplo n.º 2
0
 public SynchronizationBlocksHandler(IStatesRepository statesRepository, ISynchronizationProducer synchronizationProducer, ISerializersFactory serializersFactory,
                                     IIdentityKeyProvidersRegistry identityKeyProvidersRegistry, INodesRatingProviderFactory nodesRatingProvidersFactory, IServerCommunicationServicesRegistry communicationServicesRegistry, ISyncRegistryMemPool syncRegistryMemPool)
 {
     _synchronizationContext        = statesRepository.GetInstance <ISynchronizationContext>();
     _synchronizationProducer       = synchronizationProducer;
     _nodeContext                   = statesRepository.GetInstance <INodeContext>();
     _neighborhoodState             = statesRepository.GetInstance <INeighborhoodState>();
     _serializersFactory            = serializersFactory;
     _communicationServicesRegistry = communicationServicesRegistry;
     _syncRegistryMemPool           = syncRegistryMemPool;
     _identityKeyProvider           = identityKeyProvidersRegistry.GetInstance();
     _synchronizationBlocks         = new BlockingCollection <SynchronizationBlockBase>();
     _retransmittedBlocks           = new BlockingCollection <SynchronizationBlockRetransmissionV1>();
     _synchronizationBlocksByHeight = new Dictionary <ulong, Dictionary <IKey, List <SynchronizationBlockRetransmissionV1> > >();
     _nodesRatingProvider           = nodesRatingProvidersFactory.GetInstance(PacketType.Transactional);
 }