aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-09 19:56:27 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-09 19:56:27 +0800
commitf86707713c42da02b70a3a389684e19e902d8759 (patch)
tree0eb22642f83961147bfef44453b9398bd5409cfd /eth/handler.go
parent44147d057dd91d8b35dd6f4ed025bdb4baf225eb (diff)
downloadgo-tangerine-f86707713c42da02b70a3a389684e19e902d8759.tar
go-tangerine-f86707713c42da02b70a3a389684e19e902d8759.tar.gz
go-tangerine-f86707713c42da02b70a3a389684e19e902d8759.tar.bz2
go-tangerine-f86707713c42da02b70a3a389684e19e902d8759.tar.lz
go-tangerine-f86707713c42da02b70a3a389684e19e902d8759.tar.xz
go-tangerine-f86707713c42da02b70a3a389684e19e902d8759.tar.zst
go-tangerine-f86707713c42da02b70a3a389684e19e902d8759.zip
eth: fix data race accessing peer.td
Diffstat (limited to 'eth/handler.go')
-rw-r--r--eth/handler.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 847e7a0e8..f2027c3c6 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -356,7 +356,7 @@ func (pm *ProtocolManager) importBlock(p *peer, block *types.Block, td *big.Int)
p.blockHashes.Add(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 {