core/rawdb: increase readability

pull/29670/head
pengin7384 7 months ago
parent 46230b1e4f
commit 9dbb4830c1
  1. 6
      core/rawdb/accessors_indexes.go

@ -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

Loading…
Cancel
Save