aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-09 21:53:49 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-09 21:53:49 +0800
commit365576620a8230a193570e81e7f296d17b13fede (patch)
treeef7fe2a68ef0b112b7a1eff7d3ac4d27716b9256 /eth/handler.go
parent60b780c21b861766b06b2990b7bb8c41fd6d25f8 (diff)
parentebf2aabd254a4e765b68cdb46b18806fa7e4cb4b (diff)
downloaddexon-365576620a8230a193570e81e7f296d17b13fede.tar
dexon-365576620a8230a193570e81e7f296d17b13fede.tar.gz
dexon-365576620a8230a193570e81e7f296d17b13fede.tar.bz2
dexon-365576620a8230a193570e81e7f296d17b13fede.tar.lz
dexon-365576620a8230a193570e81e7f296d17b13fede.tar.xz
dexon-365576620a8230a193570e81e7f296d17b13fede.tar.zst
dexon-365576620a8230a193570e81e7f296d17b13fede.zip
Merge pull request #1216 from karalabe/fix-eth-dataraces
Fix various data races in eth and core
Diffstat (limited to 'eth/handler.go')
-rw-r--r--eth/handler.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 64f89b273..f2027c3c6 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,9 +354,9 @@ 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
+ p.SetTd(td)
}
// Log the block's arrival
_, chainHead, _ := pm.chainman.Status()
@@ -369,7 +369,7 @@ func (pm *ProtocolManager) importBlock(p *peer, block *types.Block, td *big.Int)
})
// If the block's already known or its difficulty is lower than ours, drop
if pm.chainman.HasBlock(hash) {
- p.td = pm.chainman.GetBlock(hash).Td // update the peer's TD to the real value
+ p.SetTd(pm.chainman.GetBlock(hash).Td) // update the peer's TD to the real value
return nil
}
if td != nil && pm.chainman.Td().Cmp(td) > 0 && new(big.Int).Add(block.Number(), big.NewInt(7)).Cmp(pm.chainman.CurrentBlock().Number()) < 0 {