public void get_transaction_returns_receipt_when_found() { var receipt = Build.A.Receipt.WithBlockHash(TestItem.KeccakB).TestObject; _receiptStorage.Find(TestItem.KeccakA).Returns(receipt); _blockchainBridge.GetTransaction(TestItem.KeccakA).Should().BeEquivalentTo((receipt, (Transaction)null)); }
public GethLikeTxTrace Trace(Keccak txHash) { TxReceipt txReceipt = _receiptStorage.Find(txHash); Block block = _blockTree.FindBlock(txReceipt.BlockNumber); if (block == null) { throw new InvalidOperationException("Only historical blocks"); } return(Trace(block, txHash)); }
public (TxReceipt Receipt, Transaction Transaction) GetTransaction(Keccak transactionHash) { TxReceipt txReceipt = _receiptStorage.Find(transactionHash); if (txReceipt?.BlockHash == null) { return(null, null); } Block block = _blockTree.FindBlock(txReceipt.BlockHash, BlockTreeLookupOptions.RequireCanonical); return(txReceipt, block?.Transactions[txReceipt.Index]); }
public (TxReceipt Receipt, Transaction Transaction) GetTransaction(Keccak transactionHash) { TxReceipt txReceipt = _receiptStorage.Find(transactionHash); if (txReceipt?.BlockHash == null) { return(null, null); } Block block = _blockTree.FindBlock(txReceipt.BlockHash, true); return(txReceipt, block.Transactions[txReceipt.Index]); }
public TxReceipt[][] GetReceipts(IList <Keccak> blockHashes) { var receipts = new TxReceipt[blockHashes.Count][]; for (int blockIndex = 0; blockIndex < blockHashes.Count; blockIndex++) { Block block = Find(blockHashes[blockIndex]); var blockReceipts = new TxReceipt[block?.Transactions.Length ?? 0]; bool setNullForBlock = false; for (int receiptIndex = 0; receiptIndex < (block?.Transactions.Length ?? 0); receiptIndex++) { if (block == null) { continue; } TxReceipt receipt = _receiptStorage.Find(block.Transactions[receiptIndex].Hash); if (receipt == null) { setNullForBlock = true; break; } receipt.BlockNumber = block.Number; blockReceipts[receiptIndex] = receipt; } receipts[blockIndex] = setNullForBlock ? null : blockReceipts; } return(receipts); }
public static SearchResult <TxReceipt> SearchForReceipt(this IReceiptStorage receiptStorage, Keccak txHash) { TxReceipt receipt = receiptStorage.Find(txHash); return(receipt == null ? new SearchResult <TxReceipt>($"{txHash} receipt could not be found", ErrorCodes.ResourceNotFound) : new SearchResult <TxReceipt>(receipt)); }
public (TxReceipt Receipt, Transaction Transaction) GetTransaction(Keccak transactionHash) { TxReceipt txReceipt = _receiptStorage.Find(transactionHash); if (txReceipt?.BlockHash != null) { Block block = _blockTree.FindBlock(txReceipt.BlockHash, BlockTreeLookupOptions.RequireCanonical); return(txReceipt, block?.Transactions[txReceipt.Index]); } else if (_txPool.TryGetPendingTransaction(transactionHash, out var transaction)) { return(null, transaction); } else { return(null, null); } }
public GethLikeTxTrace Trace(Keccak txHash, GethTraceOptions traceOptions) { TxReceipt txReceipt = _receiptStorage.Find(txHash); if (txReceipt == null) { return(null); } Block block = _blockTree.FindBlock(txReceipt.BlockNumber, BlockTreeLookupOptions.RequireCanonical); if (block == null) { return(null); } return(Trace(block, txHash, traceOptions)); }
public GethLikeTxTrace Trace(Keccak txHash) { TxReceipt txReceipt = _receiptStorage.Find(txHash); if (txReceipt == null) { return(null); } Block block = _blockTree.FindBlock(txReceipt.BlockNumber); if (block == null) { return(null); } return(Trace(block, txHash)); }
private void TestAddAndGetReceipt(IReceiptStorage storage) { var transaction = GetSignedTransaction(); var receipt = GetReceipt(transaction); storage.Add(receipt, true); var fetchedReceipt = storage.Find(transaction.Hash); receipt.PostTransactionState.Should().Be(fetchedReceipt.PostTransactionState); }
private TxReceipt[] GetReceiptsFromBlock(Block block) { TxReceipt[] result = new TxReceipt[block.Body.Transactions.Length]; for (int i = 0; i < result.Length; i++) { result[i] = _receiptStorage.Find(block.Body.Transactions[i].Hash); } return(result); }
public static TxReceipt[] FindForBlock(this IReceiptStorage receiptStorage, Block block) { TxReceipt[] result = new TxReceipt[block.Body.Transactions.Length]; for (int i = 0; i < result.Length; i++) { result[i] = receiptStorage.Find(block.Body.Transactions[i].Hash); } return(result); }
public TxReceipt Find(Keccak txHash) { return(_receiptStorage.Find(txHash)); }