Skip to content

Commit

Permalink
Place hash and index first
Browse files Browse the repository at this point in the history
Signed-off-by: Wetitpig <winsto003@hotmail.com>
  • Loading branch information
Wetitpig committed Nov 24, 2023
1 parent ea88270 commit 76779eb
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,17 +624,17 @@ public Optional<TransactionReceiptWithMetadata> transactionReceiptByTransactionH
// getTransactionLocation should not return if the TX or block doesn't exist, so throwing
// on a missing optional is appropriate.
final TransactionLocation location = maybeLocation.get();
final Block block = blockchain.getBlockByHash(location.getBlockHash()).orElseThrow();
final List<Transaction> transactions = block.getBody().getTransactions();
final Transaction transaction = transactions.get(location.getTransactionIndex());

final Hash blockhash = location.getBlockHash();
final int transactionIndex = location.getTransactionIndex();

final Block block = blockchain.getBlockByHash(blockhash).orElseThrow();
final List<Transaction> transactions = block.getBody().getTransactions();
final Transaction transaction = transactions.get(transactionIndex);

final BlockHeader header = block.getHeader();
final List<TransactionReceipt> transactionReceipts =
blockchain.getTxReceipts(blockhash).orElseThrow();
final TransactionReceipt transactionReceipt =
transactionReceipts.get(location.getTransactionIndex());
final TransactionReceipt transactionReceipt = transactionReceipts.get(transactionIndex);

long gasUsed = transactionReceipt.getCumulativeGasUsed();
int logIndexOffset = 0;
Expand All @@ -658,7 +658,7 @@ public Optional<TransactionReceiptWithMetadata> transactionReceiptByTransactionH
transactionReceipt,
transaction,
transactionHash,
location.getTransactionIndex(),
transactionIndex,
gasUsed,
header.getBaseFee(),
blockhash,
Expand Down

0 comments on commit 76779eb

Please sign in to comment.