public async Task UpdateOneBlockIndexWithoutBestChain() { var previousBlockHeader = _kernelTestHelper.BestBranchBlockList.Last().Header; var block = _kernelTestHelper.GenerateBlock(previousBlockHeader.Height, Hash.FromString("PreBlockHash")); var chain = await _blockchainService.GetChainAsync(); await AddBlockAsync(chain, block); var txId = Hash.FromString("Transaction"); var blockIndex = new BlockIndex { BlockHash = block.GetHash(), BlockHeight = block.Height }; await _transactionBlockIndexService.AddBlockIndexAsync(new List <Hash> { txId }, blockIndex); var actual = await _transactionBlockIndexService.GetTransactionBlockIndexAsync(txId); Assert.Null(actual); var cacheInBestBranch = await _transactionBlockIndexService.GetTransactionBlockIndexAsync(txId); Assert.Null(cacheInBestBranch); var cacheInForkBranch = await _transactionBlockIndexService.ValidateTransactionBlockIndexExistsInBranchAsync(txId, block.GetHash()); Assert.True(cacheInForkBranch); }
public async Task <TransactionResult> GetTransactionResultAsync(Hash transactionId) { var transactionBlockIndex = await _transactionBlockIndexService.GetTransactionBlockIndexAsync(transactionId); if (transactionBlockIndex != null) { return(await _transactionResultManager.GetTransactionResultAsync(transactionId, transactionBlockIndex.BlockHash)); } return(null); }