From 9a45917dabf42b78c243e617a4ed8e8e16d30d5e Mon Sep 17 00:00:00 2001 From: pengin7384 Date: Thu, 20 Jun 2024 21:54:19 +0900 Subject: [PATCH] rawdb: change DeriveField to DeriveFields --- core/rawdb/accessors_indexes.go | 2 +- core/types/receipt.go | 6 +++--- core/types/receipt_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/rawdb/accessors_indexes.go b/core/rawdb/accessors_indexes.go index f5bcdf2638..60ef25ce73 100644 --- a/core/rawdb/accessors_indexes.go +++ b/core/rawdb/accessors_indexes.go @@ -179,7 +179,7 @@ func ReadReceipt(db ethdb.Reader, txHash common.Hash, config *params.ChainConfig logIndex += uint(len(receipts[i].Logs)) } - if err := targetReceipt.DeriveField(signer, blockHash, *blockNumber, blockHeader.BaseFee, blobGasPrice, uint(txIndex), gasUsed, logIndex, blockBody.Transactions[txIndex]); err != nil { + if err := targetReceipt.DeriveFields(signer, blockHash, *blockNumber, blockHeader.BaseFee, blobGasPrice, uint(txIndex), gasUsed, logIndex, blockBody.Transactions[txIndex]); err != nil { log.Error("Failed to derive the receipt fields", "txHash", txHash, "err", err) return nil, common.Hash{}, 0, 0 } diff --git a/core/types/receipt.go b/core/types/receipt.go index 8468975a1f..e8cc930232 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -117,9 +117,9 @@ func NewReceipt(root []byte, failed bool, cumulativeGasUsed uint64) *Receipt { return r } -// DeriveField fills the receipt with their computed fields based on consensus +// DeriveFields fills the receipt with their computed fields based on consensus // data and contextual infos like containing block and transactions. -func (r *Receipt) DeriveField(signer Signer, hash common.Hash, number uint64, baseFee *big.Int, blobGasPrice *big.Int, txIndex uint, gasUsed uint64, firstLogIndex uint, tx *Transaction) error { +func (r *Receipt) DeriveFields(signer Signer, hash common.Hash, number uint64, baseFee *big.Int, blobGasPrice *big.Int, txIndex uint, gasUsed uint64, firstLogIndex uint, tx *Transaction) error { // The transaction type and hash can be retrieved from the transaction itself r.Type = tx.Type() r.TxHash = tx.Hash() @@ -378,7 +378,7 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu } else { gasUsed = rs[i].CumulativeGasUsed - rs[i-1].CumulativeGasUsed } - if err := rs[i].DeriveField(signer, hash, number, baseFee, blobGasPrice, uint(i), gasUsed, logIndex, txs[i]); err != nil { + if err := rs[i].DeriveFields(signer, hash, number, baseFee, blobGasPrice, uint(i), gasUsed, logIndex, txs[i]); err != nil { return err } logIndex += uint(len(rs[i].Logs)) diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index 7fc6de9f7b..f19913d1f5 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -320,9 +320,9 @@ func TestDeriveField(t *testing.T) { } else { gasUsed = derivedReceipts[i].CumulativeGasUsed - derivedReceipts[i-1].CumulativeGasUsed } - err := derivedReceipts[i].DeriveField(signer, blockHash, blockNumber.Uint64(), basefee, blobGasPrice, uint(i), gasUsed, logIndex, txs[i]) + err := derivedReceipts[i].DeriveFields(signer, blockHash, blockNumber.Uint64(), basefee, blobGasPrice, uint(i), gasUsed, logIndex, txs[i]) if err != nil { - t.Fatalf("DeriveField(...) = %v, want ", err) + t.Fatalf("DeriveFields(...) = %v, want ", err) } logIndex += uint(len(derivedReceipts[i].Logs))