@@ -19,7 +19,7 @@ package trie
1919import (
2020 "github.com/ethereum/go-ethereum/common"
2121 "github.com/ethereum/go-ethereum/core/types"
22- "github.com/ethereum/go-ethereum/crypto"
22+ "github.com/ethereum/go-ethereum/crypto/platcrypto "
2323 "github.com/ethereum/go-ethereum/rlp"
2424 "github.com/ethereum/go-ethereum/trie/trienode"
2525 "github.com/ethereum/go-ethereum/triedb/database"
@@ -102,14 +102,14 @@ func NewStateTrie(id *ID, db database.NodeDatabase) (*StateTrie, error) {
102102// This function will omit any encountered error but just
103103// print out an error message.
104104func (t * StateTrie ) MustGet (key []byte ) []byte {
105- return t .trie .MustGet (crypto .Keccak256 (key ))
105+ return t .trie .MustGet (platcrypto .Keccak256 (key ))
106106}
107107
108108// GetAccount attempts to retrieve an account with provided account address.
109109// If the specified account is not in the trie, nil will be returned.
110110// If a trie node is not found in the database, a MissingNodeError is returned.
111111func (t * StateTrie ) GetAccount (address common.Address ) (* types.StateAccount , error ) {
112- res , err := t .trie .Get (crypto .Keccak256 (address .Bytes ()))
112+ res , err := t .trie .Get (platcrypto .Keccak256 (address .Bytes ()))
113113 if res == nil || err != nil {
114114 return nil , err
115115 }
@@ -136,7 +136,7 @@ func (t *StateTrie) GetAccountByHash(addrHash common.Hash) (*types.StateAccount,
136136func (t * StateTrie ) PrefetchAccount (addresses []common.Address ) error {
137137 var keys [][]byte
138138 for _ , addr := range addresses {
139- keys = append (keys , crypto .Keccak256 (addr .Bytes ()))
139+ keys = append (keys , platcrypto .Keccak256 (addr .Bytes ()))
140140 }
141141 return t .trie .Prefetch (keys )
142142}
@@ -146,7 +146,7 @@ func (t *StateTrie) PrefetchAccount(addresses []common.Address) error {
146146// If the specified storage slot is not in the trie, nil will be returned.
147147// If a trie node is not found in the database, a MissingNodeError is returned.
148148func (t * StateTrie ) GetStorage (_ common.Address , key []byte ) ([]byte , error ) {
149- enc , err := t .trie .Get (crypto .Keccak256 (key ))
149+ enc , err := t .trie .Get (platcrypto .Keccak256 (key ))
150150 if err != nil || len (enc ) == 0 {
151151 return nil , err
152152 }
@@ -159,7 +159,7 @@ func (t *StateTrie) GetStorage(_ common.Address, key []byte) ([]byte, error) {
159159func (t * StateTrie ) PrefetchStorage (_ common.Address , keys [][]byte ) error {
160160 var keylist [][]byte
161161 for _ , key := range keys {
162- keylist = append (keylist , crypto .Keccak256 (key ))
162+ keylist = append (keylist , platcrypto .Keccak256 (key ))
163163 }
164164 return t .trie .Prefetch (keylist )
165165}
@@ -182,7 +182,7 @@ func (t *StateTrie) GetNode(path []byte) ([]byte, int, error) {
182182// This function will omit any encountered error but just print out an
183183// error message.
184184func (t * StateTrie ) MustUpdate (key , value []byte ) {
185- hk := crypto .Keccak256 (key )
185+ hk := platcrypto .Keccak256 (key )
186186 t .trie .MustUpdate (hk , value )
187187 if t .preimages != nil {
188188 t .secKeyCache [common .Hash (hk )] = common .CopyBytes (key )
@@ -198,7 +198,7 @@ func (t *StateTrie) MustUpdate(key, value []byte) {
198198//
199199// If a node is not found in the database, a MissingNodeError is returned.
200200func (t * StateTrie ) UpdateStorage (_ common.Address , key , value []byte ) error {
201- hk := crypto .Keccak256 (key )
201+ hk := platcrypto .Keccak256 (key )
202202 v , _ := rlp .EncodeToBytes (value )
203203 err := t .trie .Update (hk , v )
204204 if err != nil {
@@ -212,7 +212,7 @@ func (t *StateTrie) UpdateStorage(_ common.Address, key, value []byte) error {
212212
213213// UpdateAccount will abstract the write of an account to the secure trie.
214214func (t * StateTrie ) UpdateAccount (address common.Address , acc * types.StateAccount , _ int ) error {
215- hk := crypto .Keccak256 (address .Bytes ())
215+ hk := platcrypto .Keccak256 (address .Bytes ())
216216 data , err := rlp .EncodeToBytes (acc )
217217 if err != nil {
218218 return err
@@ -233,7 +233,7 @@ func (t *StateTrie) UpdateContractCode(_ common.Address, _ common.Hash, _ []byte
233233// MustDelete removes any existing value for key from the trie. This function
234234// will omit any encountered error but just print out an error message.
235235func (t * StateTrie ) MustDelete (key []byte ) {
236- hk := crypto .Keccak256 (key )
236+ hk := platcrypto .Keccak256 (key )
237237 if t .preimages != nil {
238238 delete (t .secKeyCache , common .Hash (hk ))
239239 }
@@ -244,7 +244,7 @@ func (t *StateTrie) MustDelete(key []byte) {
244244// If the specified trie node is not in the trie, nothing will be changed.
245245// If a node is not found in the database, a MissingNodeError is returned.
246246func (t * StateTrie ) DeleteStorage (_ common.Address , key []byte ) error {
247- hk := crypto .Keccak256 (key )
247+ hk := platcrypto .Keccak256 (key )
248248 if t .preimages != nil {
249249 delete (t .secKeyCache , common .Hash (hk ))
250250 }
@@ -253,7 +253,7 @@ func (t *StateTrie) DeleteStorage(_ common.Address, key []byte) error {
253253
254254// DeleteAccount abstracts an account deletion from the trie.
255255func (t * StateTrie ) DeleteAccount (address common.Address ) error {
256- hk := crypto .Keccak256 (address .Bytes ())
256+ hk := platcrypto .Keccak256 (address .Bytes ())
257257 if t .preimages != nil {
258258 delete (t .secKeyCache , common .Hash (hk ))
259259 }
0 commit comments