aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.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/handler.go
parent05cae69d7295a924a4d2aeb49d23869047451e08 (diff)
downloaddexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar.gz
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar.bz2
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar.lz
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar.xz
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.tar.zst
dexon-44147d057dd91d8b35dd6f4ed025bdb4baf225eb.zip
eth: fix data race accessing peer.recentHash
Diffstat (limited to 'eth/handler.go')
-rw-r--r--eth/handler.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 64f89b273..847e7a0e8 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -157,7 +157,7 @@ func (pm *ProtocolManager) handle(p *peer) error {
}
defer pm.removePeer(p.id)
- if err := pm.downloader.RegisterPeer(p.id, p.recentHash, p.requestHashes, p.requestBlocks); err != nil {
+ if err := pm.downloader.RegisterPeer(p.id, p.Head(), p.requestHashes, p.requestBlocks); err != nil {
return err
}
// propagate existing transactions. new transactions appearing
@@ -303,7 +303,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
// Mark the hashes as present at the remote node
for _, hash := range hashes {
p.blockHashes.Add(hash)
- p.recentHash = hash
+ p.SetHead(hash)
}
// Schedule all the unknown hashes for retrieval
unknown := make([]common.Hash, 0, len(hashes))
@@ -354,7 +354,7 @@ func (pm *ProtocolManager) importBlock(p *peer, block *types.Block, td *big.Int)
// Mark the block as present at the remote node (don't duplicate already held data)
p.blockHashes.Add(hash)
- p.recentHash = hash
+ p.SetHead(hash)
if td != nil {
p.td = td
}