aboutsummaryrefslogtreecommitdiffstats
path: root/eth/sync.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-09 19:27:44 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-09 19:27:44 +0800
commit44147d057dd91d8b35dd6f4ed025bdb4baf225eb (patch)
tree0747516ad8924a1e61ceb97936419d9c3f41ffd1 /eth/sync.go
parent05cae69d7295a924a4d2aeb49d23869047451e08 (diff)
downloaddexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar.gz
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar.zst
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.zip
eth: fix data race accessing peer.recentHash
Diffstat (limited to 'eth/sync.go')
-rw-r--r--eth/sync.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/eth/sync.go b/eth/sync.go
index dd7414da8..b3184364f 100644
--- a/eth/sync.go
+++ b/eth/sync.go
@@ -214,14 +214,15 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
// 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
- if pm.chainman.HasBlock(peer.recentHash) {
+ 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, peer.recentHash)
+ glog.V(logger.Detail).Infof("Attempting synchronisation: %v, 0x%x", peer.id, head)
- err := pm.downloader.Synchronise(peer.id, peer.recentHash)
+ err := pm.downloader.Synchronise(peer.id, head)
switch err {
case nil:
glog.V(logger.Detail).Infof("Synchronisation completed")