core/rawdb: increase readability

This commit is contained in:
pengin7384 2024-05-01 00:50:00 +09:00
parent 46230b1e4f
commit 9dbb4830c1
1 changed files with 40 additions and 38 deletions

View File

@ -143,7 +143,10 @@ func ReadReceipt(db ethdb.Reader, txHash common.Hash, config *params.ChainConfig
// Find a match tx and derive receipt fields // Find a match tx and derive receipt fields
for txIndex, tx := range blockBody.Transactions { for txIndex, tx := range blockBody.Transactions {
if tx.Hash() == txHash { if tx.Hash() != txHash {
continue
}
// Read raw receipts only if hash matches // Read raw receipts only if hash matches
receipts := ReadRawReceipts(db, blockHash, *blockNumber) receipts := ReadRawReceipts(db, blockHash, *blockNumber)
if receipts == nil { if receipts == nil {
@ -182,7 +185,6 @@ func ReadReceipt(db ethdb.Reader, txHash common.Hash, config *params.ChainConfig
} }
return targetReceipt, blockHash, *blockNumber, uint64(txIndex) return targetReceipt, blockHash, *blockNumber, uint64(txIndex)
} }
}
log.Error("Receipt not found", "number", *blockNumber, "blockHash", blockHash, "txHash", txHash) log.Error("Receipt not found", "number", *blockNumber, "blockHash", blockHash, "txHash", txHash)
return nil, common.Hash{}, 0, 0 return nil, common.Hash{}, 0, 0