aboutsummaryrefslogtreecommitdiffstats
path: root/eth/sync.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-11 20:56:08 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-15 14:22:36 +0800
commit66d3dc8690e0aa551e7b35a17006a2135b51c9bd (patch)
tree2e58d41dd5995e1b7c8d9c6f52b881e0c7934fbd /eth/sync.go
parent6f5c6150b7060b6b2ee68ac95b30f46c5c2c7f90 (diff)
downloadgo-tangerine-66d3dc8690e0aa551e7b35a17006a2135b51c9bd.tar.gz
go-tangerine-66d3dc8690e0aa551e7b35a17006a2135b51c9bd.tar.zst
go-tangerine-66d3dc8690e0aa551e7b35a17006a2135b51c9bd.zip
eth, eth/downloader: move peer removal into downloader
Diffstat (limited to 'eth/sync.go')
-rw-r--r--eth/sync.go32
1 files changed, 2 insertions, 30 deletions
diff --git a/eth/sync.go b/eth/sync.go
index 8fee21d7b..b127ca979 100644
--- a/eth/sync.go
+++ b/eth/sync.go
@@ -8,7 +8,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p/discover"
@@ -332,33 +331,6 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
if peer.Td().Cmp(pm.chainman.Td()) <= 0 {
return
}
- // FIXME if we have the hash in our chain and the TD of the peer is
- // much higher than ours, something is wrong with us or the peer.
- // Check if the hash is on our own chain
- head := peer.Head()
- if pm.chainman.HasBlock(head) {
- glog.V(logger.Debug).Infoln("Synchronisation canceled: head already known")
- return
- }
- // Get the hashes from the peer (synchronously)
- glog.V(logger.Detail).Infof("Attempting synchronisation: %v, 0x%x", peer.id, head)
-
- err := pm.downloader.Synchronise(peer.id, head)
- switch err {
- case nil:
- glog.V(logger.Detail).Infof("Synchronisation completed")
-
- case downloader.ErrBusy:
- glog.V(logger.Detail).Infof("Synchronisation already in progress")
-
- case downloader.ErrTimeout, downloader.ErrBadPeer, downloader.ErrEmptyHashSet, downloader.ErrInvalidChain, downloader.ErrCrossCheckFailed:
- glog.V(logger.Debug).Infof("Removing peer %v: %v", peer.id, err)
- pm.removePeer(peer.id)
-
- case downloader.ErrPendingQueue:
- glog.V(logger.Debug).Infoln("Synchronisation aborted:", err)
-
- default:
- glog.V(logger.Warn).Infof("Synchronisation failed: %v", err)
- }
+ // Otherwise try to sync with the downloader
+ pm.downloader.Synchronise(peer.id, peer.Head())
}