diff options
author | gary rong <garyrong0905@gmail.com> | 2019-06-05 20:00:46 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2019-06-05 20:00:46 +0800 |
commit | 7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89 (patch) | |
tree | 64692849eb8b74972b819340c99e7d305169290f /eth/downloader/statesync.go | |
parent | 645756cda5becf364ec9442891e9b7a7945e2cb3 (diff) | |
download | go-tangerine-7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89.tar go-tangerine-7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89.tar.gz go-tangerine-7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89.tar.bz2 go-tangerine-7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89.tar.lz go-tangerine-7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89.tar.xz go-tangerine-7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89.tar.zst go-tangerine-7641bbe5354bcbcd17c3aa154cf3a2d9a8ef0e89.zip |
eth/downloader: make syncing error more obvious (#19413)
Diffstat (limited to 'eth/downloader/statesync.go')
-rw-r--r-- | eth/downloader/statesync.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/eth/downloader/statesync.go b/eth/downloader/statesync.go index 7e156f46e..1ccdf4def 100644 --- a/eth/downloader/statesync.go +++ b/eth/downloader/statesync.go @@ -302,7 +302,7 @@ func (s *stateSync) loop() (err error) { return errCancelStateFetch case <-s.d.cancelCh: - return errCancelStateFetch + return errCanceled case req := <-s.deliver: // Response, disconnect or timeout triggered, drop the peer if stalling @@ -317,6 +317,16 @@ func (s *stateSync) loop() (err error) { req.peer.log.Warn("Downloader wants to drop peer, but peerdrop-function is not set", "peer", req.peer.id) } else { s.d.dropPeer(req.peer.id) + + // If this peer was the master peer, abort sync immediately + s.d.cancelLock.RLock() + master := req.peer.id == s.d.cancelPeer + s.d.cancelLock.RUnlock() + + if master { + s.d.cancel() + return errTimeout + } } } // Process all the received blobs and check for stale delivery |