diff --git a/cmd/util.go b/cmd/util.go index 22c9b7a..cbc18f6 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -10,7 +10,8 @@ import ( "github.com/cerc-io/plugeth-statediff/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/triedb" + "github.com/ethereum/go-ethereum/triedb/hashdb" "github.com/spf13/viper" pkg "github.com/cerc-io/eth-statediff-service/pkg" @@ -117,10 +118,12 @@ func instantiateLevelDBReader() (pkg.Reader, *params.ChainConfig, node.Info) { // create LevelDB reader logWithCommand.Debug("Creating LevelDB reader") readerConf := pkg.LvLDBReaderConfig{ - TrieConfig: &trie.Config{ - Cache: viper.GetInt("cache.trie"), - Journal: "", + TrieConfig: &triedb.Config{ Preimages: false, + IsVerkle: false, + HashDB: &hashdb.Config{ + CleanCacheSize: viper.GetInt("cache.trie"), + }, }, ChainConfig: chainConf, Mode: mode, diff --git a/pkg/reader.go b/pkg/reader.go index 21e506b..3bffa57 100644 --- a/pkg/reader.go +++ b/pkg/reader.go @@ -27,7 +27,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/triedb" ) // Reader interface required by the statediffing service @@ -49,7 +49,7 @@ type LvlDBReader struct { // LvLDBReaderConfig struct for initializing a LvlDBReader type LvLDBReaderConfig struct { - TrieConfig *trie.Config + TrieConfig *triedb.Config ChainConfig *params.ChainConfig Mode string Path, AncientPath, Url string @@ -114,7 +114,11 @@ func (ldr *LvlDBReader) GetReceiptsByHash(hash common.Hash) (types.Receipts, err if number == nil { return nil, fmt.Errorf("unable to read header height for header hash %s", hash) } - receipts := rawdb.ReadReceipts(ldr.ethDB, hash, *number, ldr.chainConfig) + header := rawdb.ReadHeader(ldr.ethDB, hash, *number) + if header == nil { + return nil, fmt.Errorf("unable to read header for header hash %s", hash) + } + receipts := rawdb.ReadReceipts(ldr.ethDB, hash, *number, header.Time, ldr.chainConfig) if receipts == nil { return nil, fmt.Errorf("unable to read receipts at height %d hash %s", number, hash) }