Пример #1
0
            public async Task HandleEventAsync(BlockMinedEventData eventData)
            {
                if (eventData?.BlockHeader == null)
                {
                    Logger.LogWarning("Block header is null, cannot broadcast.");
                    return;
                }

                var blockWithTransactions = await BlockchainService.GetBlockWithTransactionsByHash(eventData.BlockHeader.GetHash());

                if (blockWithTransactions == null)
                {
                    Logger.LogWarning($"Could not find {eventData.BlockHeader.GetHash()}.");
                    return;
                }

                var _ = NetworkService.BroadcastBlockWithTransactionsAsync(blockWithTransactions);
            }