@@ -18,13 +18,13 @@ package downloader
1818
1919import (
2020 "fmt"
21- "hash"
2221 "sync"
2322 "time"
2423
2524 "github.com/ethereum/go-ethereum/common"
2625 "github.com/ethereum/go-ethereum/core/rawdb"
2726 "github.com/ethereum/go-ethereum/core/state"
27+ "github.com/ethereum/go-ethereum/crypto"
2828 "github.com/ethereum/go-ethereum/ethdb"
2929 "github.com/ethereum/go-ethereum/log"
3030 "github.com/ethereum/go-ethereum/trie"
@@ -260,9 +260,9 @@ func (d *Downloader) spindownStateSync(active map[string]*stateReq, finished []*
260260type stateSync struct {
261261 d * Downloader // Downloader instance to access and manage current peerset
262262
263- root common.Hash // State root currently being synced
264- sched * trie.Sync // State trie sync scheduler defining the tasks
265- keccak hash. Hash // Keccak256 hasher to verify deliveries with
263+ root common.Hash // State root currently being synced
264+ sched * trie.Sync // State trie sync scheduler defining the tasks
265+ keccak crypto. KeccakState // Keccak256 hasher to verify deliveries with
266266
267267 trieTasks map [common.Hash ]* trieTask // Set of trie node tasks currently queued for retrieval
268268 codeTasks map [common.Hash ]* codeTask // Set of byte code tasks currently queued for retrieval
@@ -299,7 +299,7 @@ func newStateSync(d *Downloader, root common.Hash) *stateSync {
299299 d : d ,
300300 root : root ,
301301 sched : state .NewStateSync (root , d .stateDB , d .stateBloom ),
302- keccak : sha3 .NewLegacyKeccak256 (),
302+ keccak : sha3 .NewLegacyKeccak256 ().(crypto. KeccakState ) ,
303303 trieTasks : make (map [common.Hash ]* trieTask ),
304304 codeTasks : make (map [common.Hash ]* codeTask ),
305305 deliver : make (chan * stateReq ),
@@ -590,7 +590,7 @@ func (s *stateSync) processNodeData(blob []byte) (common.Hash, error) {
590590 res := trie.SyncResult {Data : blob }
591591 s .keccak .Reset ()
592592 s .keccak .Write (blob )
593- s .keccak .Sum (res .Hash [:0 ])
593+ s .keccak .Read (res .Hash [:])
594594 err := s .sched .Process (res )
595595 return res .Hash , err
596596}
0 commit comments