Idle too long error incorrectly triggered even when peer sending new blocks

- fix status chain map uses common.Hash as key
- add badPeers increment to IncorrectTD errors (forgotten)
- signal head info update to head section process even if parent hash is not in pool (inserted), so that idle timer can be set to nil
- suicideC -> peer.headInfoTimer
- quit -> peer.bestIdleTimer
- and they are properly set from within getBlockHashes and handleSection
This commit is contained in:
zelig
2015-03-22 02:02:24 +00:00
parent 7f85608f30
commit 95038fc62d
4 changed files with 31 additions and 28 deletions
+3
View File
@@ -757,6 +757,9 @@ func (self *BlockPool) checkTD(nodes ...*node) {
plog.DebugDetailf("peer td %v =?= block td %v", n.td, n.block.Td)
if n.td.Cmp(n.block.Td) != 0 {
self.peers.peerError(n.blockBy, ErrIncorrectTD, "on block %x", n.hash)
self.status.lock.Lock()
self.status.badPeers[n.blockBy]++
self.status.lock.Unlock()
}
}
}