aboutsummaryrefslogtreecommitdiffstats
path: root/dex/downloader/statesync.go
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2019-03-27 20:02:55 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-13 18:11:44 +0800
commitc52c9e04a916fac3550b0a3c3d8cdf979ab70bb8 (patch)
treeaa9e20f32fa084fd9c5e2fbfcee295d5d63b1d48 /dex/downloader/statesync.go
parent7b8b4fcb0e8fd411bf523d06492e966e20e1b613 (diff)
downloadgo-tangerine-c52c9e04a916fac3550b0a3c3d8cdf979ab70bb8.tar
go-tangerine-c52c9e04a916fac3550b0a3c3d8cdf979ab70bb8.tar.gz
go-tangerine-c52c9e04a916fac3550b0a3c3d8cdf979ab70bb8.tar.bz2
go-tangerine-c52c9e04a916fac3550b0a3c3d8cdf979ab70bb8.tar.lz
go-tangerine-c52c9e04a916fac3550b0a3c3d8cdf979ab70bb8.tar.xz
go-tangerine-c52c9e04a916fac3550b0a3c3d8cdf979ab70bb8.tar.zst
go-tangerine-c52c9e04a916fac3550b0a3c3d8cdf979ab70bb8.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.go11
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++