@@ -19,7 +19,7 @@ package trie
19
19
import (
20
20
"github.com/ethereum/go-ethereum/common"
21
21
"github.com/ethereum/go-ethereum/core/types"
22
- "github.com/ethereum/go-ethereum/crypto"
22
+ "github.com/ethereum/go-ethereum/crypto/platcrypto "
23
23
"github.com/ethereum/go-ethereum/rlp"
24
24
"github.com/ethereum/go-ethereum/trie/trienode"
25
25
"github.com/ethereum/go-ethereum/triedb/database"
@@ -102,14 +102,14 @@ func NewStateTrie(id *ID, db database.NodeDatabase) (*StateTrie, error) {
102
102
// This function will omit any encountered error but just
103
103
// print out an error message.
104
104
func (t * StateTrie ) MustGet (key []byte ) []byte {
105
- return t .trie .MustGet (crypto .Keccak256 (key ))
105
+ return t .trie .MustGet (platcrypto .Keccak256 (key ))
106
106
}
107
107
108
108
// GetAccount attempts to retrieve an account with provided account address.
109
109
// If the specified account is not in the trie, nil will be returned.
110
110
// If a trie node is not found in the database, a MissingNodeError is returned.
111
111
func (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 ()))
113
113
if res == nil || err != nil {
114
114
return nil , err
115
115
}
@@ -136,7 +136,7 @@ func (t *StateTrie) GetAccountByHash(addrHash common.Hash) (*types.StateAccount,
136
136
func (t * StateTrie ) PrefetchAccount (addresses []common.Address ) error {
137
137
var keys [][]byte
138
138
for _ , addr := range addresses {
139
- keys = append (keys , crypto .Keccak256 (addr .Bytes ()))
139
+ keys = append (keys , platcrypto .Keccak256 (addr .Bytes ()))
140
140
}
141
141
return t .trie .Prefetch (keys )
142
142
}
@@ -146,7 +146,7 @@ func (t *StateTrie) PrefetchAccount(addresses []common.Address) error {
146
146
// If the specified storage slot is not in the trie, nil will be returned.
147
147
// If a trie node is not found in the database, a MissingNodeError is returned.
148
148
func (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 ))
150
150
if err != nil || len (enc ) == 0 {
151
151
return nil , err
152
152
}
@@ -159,7 +159,7 @@ func (t *StateTrie) GetStorage(_ common.Address, key []byte) ([]byte, error) {
159
159
func (t * StateTrie ) PrefetchStorage (_ common.Address , keys [][]byte ) error {
160
160
var keylist [][]byte
161
161
for _ , key := range keys {
162
- keylist = append (keylist , crypto .Keccak256 (key ))
162
+ keylist = append (keylist , platcrypto .Keccak256 (key ))
163
163
}
164
164
return t .trie .Prefetch (keylist )
165
165
}
@@ -182,7 +182,7 @@ func (t *StateTrie) GetNode(path []byte) ([]byte, int, error) {
182
182
// This function will omit any encountered error but just print out an
183
183
// error message.
184
184
func (t * StateTrie ) MustUpdate (key , value []byte ) {
185
- hk := crypto .Keccak256 (key )
185
+ hk := platcrypto .Keccak256 (key )
186
186
t .trie .MustUpdate (hk , value )
187
187
if t .preimages != nil {
188
188
t .secKeyCache [common .Hash (hk )] = common .CopyBytes (key )
@@ -198,7 +198,7 @@ func (t *StateTrie) MustUpdate(key, value []byte) {
198
198
//
199
199
// If a node is not found in the database, a MissingNodeError is returned.
200
200
func (t * StateTrie ) UpdateStorage (_ common.Address , key , value []byte ) error {
201
- hk := crypto .Keccak256 (key )
201
+ hk := platcrypto .Keccak256 (key )
202
202
v , _ := rlp .EncodeToBytes (value )
203
203
err := t .trie .Update (hk , v )
204
204
if err != nil {
@@ -212,7 +212,7 @@ func (t *StateTrie) UpdateStorage(_ common.Address, key, value []byte) error {
212
212
213
213
// UpdateAccount will abstract the write of an account to the secure trie.
214
214
func (t * StateTrie ) UpdateAccount (address common.Address , acc * types.StateAccount , _ int ) error {
215
- hk := crypto .Keccak256 (address .Bytes ())
215
+ hk := platcrypto .Keccak256 (address .Bytes ())
216
216
data , err := rlp .EncodeToBytes (acc )
217
217
if err != nil {
218
218
return err
@@ -233,7 +233,7 @@ func (t *StateTrie) UpdateContractCode(_ common.Address, _ common.Hash, _ []byte
233
233
// MustDelete removes any existing value for key from the trie. This function
234
234
// will omit any encountered error but just print out an error message.
235
235
func (t * StateTrie ) MustDelete (key []byte ) {
236
- hk := crypto .Keccak256 (key )
236
+ hk := platcrypto .Keccak256 (key )
237
237
if t .preimages != nil {
238
238
delete (t .secKeyCache , common .Hash (hk ))
239
239
}
@@ -244,7 +244,7 @@ func (t *StateTrie) MustDelete(key []byte) {
244
244
// If the specified trie node is not in the trie, nothing will be changed.
245
245
// If a node is not found in the database, a MissingNodeError is returned.
246
246
func (t * StateTrie ) DeleteStorage (_ common.Address , key []byte ) error {
247
- hk := crypto .Keccak256 (key )
247
+ hk := platcrypto .Keccak256 (key )
248
248
if t .preimages != nil {
249
249
delete (t .secKeyCache , common .Hash (hk ))
250
250
}
@@ -253,7 +253,7 @@ func (t *StateTrie) DeleteStorage(_ common.Address, key []byte) error {
253
253
254
254
// DeleteAccount abstracts an account deletion from the trie.
255
255
func (t * StateTrie ) DeleteAccount (address common.Address ) error {
256
- hk := crypto .Keccak256 (address .Bytes ())
256
+ hk := platcrypto .Keccak256 (address .Bytes ())
257
257
if t .preimages != nil {
258
258
delete (t .secKeyCache , common .Hash (hk ))
259
259
}
0 commit comments