예제 #1
0
        private void CreateAndDistributeConfirmationBlock(RegistryFullBlock transactionsFullBlockMostConfident)
        {
            RegistryConfirmationBlock registryConfirmationBlock = new RegistryConfirmationBlock
            {
                SyncBlockHeight     = transactionsFullBlockMostConfident.SyncBlockHeight,
                Nonce               = transactionsFullBlockMostConfident.Nonce,
                PowHash             = transactionsFullBlockMostConfident.PowHash,
                BlockHeight         = transactionsFullBlockMostConfident.BlockHeight,
                ReferencedBlockHash = transactionsFullBlockMostConfident.ShortBlockHash
            };

            ShardDescriptor shardDescriptor = _syncShardsManager.GetShardDescriptorByRound((int)transactionsFullBlockMostConfident.BlockHeight);
            ISerializer     registryConfirmationBlockSerializer = _signatureSupportSerializersFactory.Create(registryConfirmationBlock);

            _communicationService.PostMessage(_syncRegistryNeighborhoodState.GetAllNeighbors(), registryConfirmationBlockSerializer);
        }
예제 #2
0
        public void UpdateTransactionalShards()
        {
            lock (_sync)
            {
                IEnumerable <Node> nodes = _nodesDataService.GetAll().Where(n => n.NodeRole == NodeRole.TransactionsRegistrationLayer);

                List <ShardDescriptor> shardDescriptors = new List <ShardDescriptor>();
                ShardDescriptor        shardDescriptor  = new ShardDescriptor();
                shardDescriptors.Add(shardDescriptor);

                foreach (var node in nodes)
                {
                    //TODO: apply usage of _synchronizationContext.LastBlockDescriptor for building shards
                    shardDescriptor.Nodes.Add(node.Key);
                }

                _shardDescriptors = new ReadOnlyCollection <ShardDescriptor>(shardDescriptors);
            }
        }