Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Duplicate call to TryGetPendingTransaction in RPC #6420

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Facade/BlockchainBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Block? HeadBlock
return (null, null, 0);
}

public (TxReceipt? Receipt, Transaction Transaction, UInt256? baseFee) GetTransaction(Hash256 txHash)
public (TxReceipt? Receipt, Transaction Transaction, UInt256? baseFee) GetTransaction(Hash256 txHash, bool checkTxnPool = true)
{
Hash256 blockHash = _receiptFinder.FindBlockHash(txHash);
if (blockHash is not null)
Expand All @@ -113,7 +113,7 @@ public Block? HeadBlock
return (txReceipt, block?.Transactions[txReceipt.Index], block?.BaseFeePerGas);
}

if (_txPool.TryGetPendingTransaction(txHash, out Transaction? transaction))
if (checkTxnPool && _txPool.TryGetPendingTransaction(txHash, out Transaction? transaction))
{
return (null, transaction, null);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Facade/IBlockchainBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface IBlockchainBridge : ILogFinder
Address? RecoverTxSender(Transaction tx);
TxReceipt GetReceipt(Hash256 txHash);
(TxReceipt? Receipt, TxGasInfo? GasInfo, int LogIndexStart) GetReceiptAndGasInfo(Hash256 txHash);
(TxReceipt? Receipt, Transaction Transaction, UInt256? baseFee) GetTransaction(Hash256 txHash);
(TxReceipt? Receipt, Transaction Transaction, UInt256? baseFee) GetTransaction(Hash256 txHash, bool checkTxnPool = true);
BlockchainBridge.CallOutput Call(BlockHeader header, Transaction tx, CancellationToken cancellationToken);
BlockchainBridge.CallOutput EstimateGas(BlockHeader header, Transaction tx, CancellationToken cancellationToken);
BlockchainBridge.CallOutput CreateAccessList(BlockHeader header, Transaction tx, CancellationToken cancellationToken, bool optimize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public Task<ResultWrapper<TransactionForRpc>> eth_getTransactionByHash(Hash256 t
TxReceipt receipt = null; // note that if transaction is pending then for sure no receipt is known
if (transaction is null)
{
(receipt, transaction, baseFee) = _blockchainBridge.GetTransaction(transactionHash);
(receipt, transaction, baseFee) = _blockchainBridge.GetTransaction(transactionHash, checkTxnPool: false);
if (transaction is null)
{
return Task.FromResult(ResultWrapper<TransactionForRpc>.Success(null));
Expand Down