public void get_transaction_returns_null_when_block_not_found() { var receipt = Build.A.Receipt.WithBlockHash(TestItem.KeccakB).TestObject; _receiptStorage.FindBlockHash(TestItem.KeccakA).Returns(TestItem.KeccakB); _blockchainBridge.GetTransaction(TestItem.KeccakA).Should().Be((null, null)); }
private void TestAddAndGetReceipt(IReceiptStorage storage, IReceiptFinder receiptFinder = null) { bool recoverSender = receiptFinder is not null; receiptFinder ??= storage; var transaction = GetSignedTransaction(); transaction.SenderAddress = null; var block = GetBlock(transaction); var receipt = GetReceipt(transaction, block); storage.Insert(block, receipt); var blockHash = storage.FindBlockHash(transaction.Hash); blockHash.Should().Be(block.Hash); var fetchedReceipt = receiptFinder.Get(block).ForTransaction(transaction.Hash); receipt.StatusCode.Should().Be(fetchedReceipt.StatusCode); receipt.PostTransactionState.Should().Be(fetchedReceipt.PostTransactionState); receipt.TxHash.Should().Be(transaction.Hash); if (recoverSender) { receipt.Sender.Should().BeEquivalentTo(TestItem.AddressA); } }
private void TestAddAndGetReceiptEip658(IReceiptStorage storage) { var transaction = GetSignedTransaction(); var block = GetBlock(transaction); var receipt = GetReceipt(transaction, block); storage.Insert(block, receipt); var blockHash = storage.FindBlockHash(transaction.Hash); blockHash.Should().Be(block.Hash); var fetchedReceipt = storage.Get(block).ForTransaction(transaction.Hash); receipt.StatusCode.Should().Be(fetchedReceipt.StatusCode); receipt.PostTransactionState.Should().Be(fetchedReceipt.PostTransactionState); receipt.TxHash.Should().Be(transaction.Hash); }
public GethLikeTxTrace Trace(Keccak txHash, GethTraceOptions traceOptions) { Keccak blockHash = _receiptStorage.FindBlockHash(txHash); if (blockHash == null) { return(null); } Block block = _blockTree.FindBlock(blockHash, BlockTreeLookupOptions.RequireCanonical); if (block == null) { return(null); } return(Trace(block, txHash, traceOptions)); }
public Keccak FindBlockHash(Keccak txHash) => _inStorage.FindBlockHash(txHash);
public Keccak FindBlockHash(Keccak txHash) => _receiptStorage.FindBlockHash(txHash);