예제 #1
0
        private void ProcessBlocks(CancellationToken ct)
        {
            foreach (ITransactionRegistryBlock transactionRegisterBlock in _registrationBlocks.GetConsumingEnumerable(ct))
            {
                if (_timer == null)
                {
                    _timer = new Timer(new TimerCallback(TimerElapsed), _registryMemPool, 120000, Timeout.Infinite);
                }

                //TODO: add logic that will check whether received Transaction Header was already stored into blockchain

                bool isNew = _registryMemPool.EnqueueTransactionRegisterBlock(transactionRegisterBlock);

                if (isNew)
                {
                    IPacketProvider packetProvider = _rawPacketProvidersFactory.Create(transactionRegisterBlock);
                    _udpCommunicationService.PostMessage(_registryGroupState.GetAllNeighbors(), packetProvider);
                }
            }
        }