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); }
protected override Memory <byte> ParseSigned(ushort version, Memory <byte> spanBody, out SignedPacketBase syncedBlockBase) { if (version == 1) { RegistryConfirmationBlock block = new RegistryConfirmationBlock { ReferencedBlockHash = spanBody.Slice(0, Globals.DEFAULT_HASH_SIZE).ToArray() }; syncedBlockBase = block; return(spanBody.Slice(Globals.DEFAULT_HASH_SIZE)); } throw new BlockVersionNotSupportedException(version, BlockType); }
private void ProcessConfirmationBlock(RegistryConfirmationBlock confirmationBlock) { _registryGroupState.ToggleLastBlockConfirmationReceived(); RegistryShortBlock registryShortBlock = _registryMemPool.GetRegistryShortBlockByHash(confirmationBlock.SyncBlockHeight, confirmationBlock.BlockHeight, confirmationBlock.ReferencedBlockHash); if (registryShortBlock != null) { if (registryShortBlock.TransactionHeaderHashes.Count > 0) { } _registryMemPool.ClearByConfirmed(registryShortBlock); } //TODO: obtain Transactions Registry Short block from MemPool by hash given in confirmationBlock //TODO: clear MemPool from Transaction Headers of confirmed Short Block }
private bool ValidateConfirmationBlock(RegistryConfirmationBlock confirmationBlock) { return(true); }