eth/downloader: progress in stateSync not used anymore (#17998)

This commit is contained in:
Wenbiao Zheng 2018-12-22 06:36:14 +08:00 committed by Felix Lange
parent ca7c13ba8f
commit 81c3dc728f

View File

@ -398,9 +398,8 @@ func (s *stateSync) fillTasks(n int, req *stateReq) {
// process iterates over a batch of delivered state data, injecting each item // process iterates over a batch of delivered state data, injecting each item
// into a running state sync, re-queuing any items that were requested but not // into a running state sync, re-queuing any items that were requested but not
// delivered. // delivered. Returns whether the peer actually managed to deliver anything of
// Returns whether the peer actually managed to deliver anything of value, // value, and any error that occurred.
// and any error that occurred
func (s *stateSync) process(req *stateReq) (int, error) { func (s *stateSync) process(req *stateReq) (int, error) {
// Collect processing stats and update progress if valid data was received // Collect processing stats and update progress if valid data was received
duplicate, unexpected, successful := 0, 0, 0 duplicate, unexpected, successful := 0, 0, 0
@ -412,14 +411,12 @@ func (s *stateSync) process(req *stateReq) (int, error) {
}(time.Now()) }(time.Now())
// Iterate over all the delivered data and inject one-by-one into the trie // Iterate over all the delivered data and inject one-by-one into the trie
progress := false
for _, blob := range req.response { for _, blob := range req.response {
prog, hash, err := s.processNodeData(blob) _, hash, err := s.processNodeData(blob)
switch err { switch err {
case nil: case nil:
s.numUncommitted++ s.numUncommitted++
s.bytesUncommitted += len(blob) s.bytesUncommitted += len(blob)
progress = progress || prog
successful++ successful++
case trie.ErrNotRequested: case trie.ErrNotRequested:
unexpected++ unexpected++