Exemplo n.º 1
0
        public async Task <Block> GetBlock(string id)
        {
            Block block;

            try
            {
                block = await BlockRepository.GetById(id);

                if (block == null)
                {
                    block = await BlockchainDataProvider.GetBlock(id);

                    if (block != null)
                    {
                        await BlockRepository.Save(block);
                    }
                }
            }
            catch (Exception ex)
            {
                _log.LogError(ex.Message);
                return(null);
            }

            return(block);
        }
Exemplo n.º 2
0
        public async Task <Block> GetBlock(string id)
        {
            Block block;

            try
            {
                block = await BlockRepository.GetById(id);

                if (block == null)
                {
                    block = await BlockchainDataProvider.GetBlock(id);

                    if (block != null)
                    {
                        await BlockRepository.Save(block);
                    }
                }
            }
            catch (Exception ex)
            {
                await Log.WriteError(this.GetType().ToString(), "GetBlock", $"block_id:{id}", ex, DateTime.Now);

                return(null);
            }

            return(block);
        }