rawdb: change DeriveField to DeriveFields
This commit is contained in:
parent
9dbb4830c1
commit
9a45917dab
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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 <nil>", err)
|
||||
t.Fatalf("DeriveFields(...) = %v, want <nil>", err)
|
||||
}
|
||||
logIndex += uint(len(derivedReceipts[i].Logs))
|
||||
|
||||
|
|
Loading…
Reference in New Issue