コード例 #1
0
        private async Task <bool> CheckExecutedDataInStoreAsync(BlockStateSet blockStateSet, string key,
                                                                ByteString blockExecutedData)
        {
            var stateReturn = await _blockchainExecutedDataManager.GetExecutedCacheAsync(key, blockStateSet.BlockHeight,
                                                                                         blockStateSet.BlockHash);

            stateReturn.Value.ShouldBe(blockExecutedData);
            return(stateReturn.IsInStore);
        }
コード例 #2
0
        public T GetBlockExecutedData(IBlockIndex chainContext, string key)
        {
            if (!_changeHeight.TryGetValue(key, out _) && _dictionary.TryGetValue(key, out var value))
            {
                return(value);
            }

            var ret = AsyncHelper.RunSync(() => _blockchainExecutedDataManager.GetExecutedCacheAsync(key,
                                                                                                     chainContext.BlockHeight,
                                                                                                     chainContext.BlockHash));

            var blockExecutedData = Deserialize(ret.Value);

            //if executed is in Store, it will not change when forking
            if (ret.IsInStore && !_changeHeight.TryGetValue(key, out _))
            {
                _dictionary[key] = blockExecutedData;
            }
            return(blockExecutedData);
        }
コード例 #3
0
 public async Task <ByteString> GetBlockExecutedDataAsync(IBlockIndex chainContext, string key)
 {
     return((await _blockchainExecutedDataManager.GetExecutedCacheAsync(key, chainContext.BlockHeight,
                                                                        chainContext.BlockHash)).Value);
 }