Skip to content

Commit 81312f7

Browse files
committed
core/rawdb: remove unused function
1 parent 237f3f9 commit 81312f7

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

core/rawdb/accessors_chain_test.go

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ package rawdb
1919
import (
2020
"bytes"
2121
"encoding/hex"
22-
"errors"
2322
"fmt"
2423
"math/big"
2524
"math/rand"
2625
"os"
2726
"reflect"
2827
"testing"
28+
"time"
2929

3030
"github.com/ethereum/go-ethereum/common"
3131
"github.com/ethereum/go-ethereum/core/types"
@@ -768,27 +768,6 @@ func TestReadLogs(t *testing.T) {
768768
}
769769
}
770770

771-
// deriveLogFields fills the logs in receiptLogs with information such as block number, txhash, etc.
772-
func deriveLogFields(receipts []*receiptLogs, hash common.Hash, number uint64, txs types.Transactions) error {
773-
logIndex := uint(0)
774-
if len(txs) != len(receipts) {
775-
return errors.New("transaction and receipt count mismatch")
776-
}
777-
for i := 0; i < len(receipts); i++ {
778-
txHash := txs[i].Hash()
779-
// The derived log fields can simply be set from the block and transaction
780-
for j := 0; j < len(receipts[i].Logs); j++ {
781-
receipts[i].Logs[j].BlockNumber = number
782-
receipts[i].Logs[j].BlockHash = hash
783-
receipts[i].Logs[j].TxHash = txHash
784-
receipts[i].Logs[j].TxIndex = uint(i)
785-
receipts[i].Logs[j].Index = logIndex
786-
logIndex++
787-
}
788-
}
789-
return nil
790-
}
791-
792771
func TestDeriveLogFields(t *testing.T) {
793772
// Create a few transactions to have receipts for
794773
to2 := common.HexToAddress("0x2")
@@ -816,7 +795,7 @@ func TestDeriveLogFields(t *testing.T) {
816795
}),
817796
}
818797
// Create the corresponding receipts
819-
receipts := []*receiptLogs{
798+
receipts := []*types.Receipt{
820799
{
821800
Logs: []*types.Log{
822801
{Address: common.BytesToAddress([]byte{0x11})},
@@ -840,9 +819,7 @@ func TestDeriveLogFields(t *testing.T) {
840819
// Derive log metadata fields
841820
number := big.NewInt(1)
842821
hash := common.BytesToHash([]byte{0x03, 0x14})
843-
if err := deriveLogFields(receipts, hash, number.Uint64(), txs); err != nil {
844-
t.Fatal(err)
845-
}
822+
types.Receipts(receipts).DeriveFields(params.TestChainConfig, hash, number.Uint64(), uint64(time.Now().Unix()), big.NewInt(0), big.NewInt(0), txs)
846823

847824
// Iterate over all the computed fields and check that they're correct
848825
logIndex := uint(0)

0 commit comments

Comments
 (0)