diff options
author | Sonic <sonic@dexon.org> | 2019-03-27 20:02:55 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:58 +0800 |
commit | 91981becf98b988470810aa1c26d86de2d294e29 (patch) | |
tree | aeb9b175a5cce93e6bbe8870028e151096bc6759 /dex/downloader/statesync.go | |
parent | a29eba604b1a58ea414a6570223dedb0482cefaf (diff) | |
download | dexon-91981becf98b988470810aa1c26d86de2d294e29.tar dexon-91981becf98b988470810aa1c26d86de2d294e29.tar.gz dexon-91981becf98b988470810aa1c26d86de2d294e29.tar.bz2 dexon-91981becf98b988470810aa1c26d86de2d294e29.tar.lz dexon-91981becf98b988470810aa1c26d86de2d294e29.tar.xz dexon-91981becf98b988470810aa1c26d86de2d294e29.tar.zst dexon-91981becf98b988470810aa1c26d86de2d294e29.zip |
backport from v1.8.23 (#304)
* dex: backport f6193ad
* dex/downloader: backport accc0fa accc0fab 174083c3
* dex: backport 434dd5b
* dex: backport 42a914a 0983d02
* dex: backport 48b70ec 31b3334 and some modification
* dex/downloader: backport 5f251a6
* dex/downloader: backport 81c3dc7
* dex, dex/downloader: fix typos
Diffstat (limited to 'dex/downloader/statesync.go')
-rw-r--r-- | dex/downloader/statesync.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/dex/downloader/statesync.go b/dex/downloader/statesync.go index 49117abbb..1695ba19c 100644 --- a/dex/downloader/statesync.go +++ b/dex/downloader/statesync.go @@ -152,7 +152,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync { finished = append(finished, req) delete(active, pack.PeerId()) - // Handle dropped peer connections: + // Handle dropped peer connections: case p := <-peerDrop: // Skip if no request is currently pending req := active[p.id] @@ -398,9 +398,8 @@ func (s *stateSync) fillTasks(n int, req *stateReq) { // 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 -// delivered. -// Returns whether the peer actually managed to deliver anything of value, -// and any error that occurred +// delivered. Returns whether the peer actually managed to deliver anything of +// value, and any error that occurred func (s *stateSync) process(req *stateReq) (int, error) { // Collect processing stats and update progress if valid data was received duplicate, unexpected, successful := 0, 0, 0 @@ -412,14 +411,12 @@ func (s *stateSync) process(req *stateReq) (int, error) { }(time.Now()) // Iterate over all the delivered data and inject one-by-one into the trie - progress := false for _, blob := range req.response { - prog, hash, err := s.processNodeData(blob) + _, hash, err := s.processNodeData(blob) switch err { case nil: s.numUncommitted++ s.bytesUncommitted += len(blob) - progress = progress || prog successful++ case trie.ErrNotRequested: unexpected++ |