forked from cerc-io/plugeth
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:
@@ -176,9 +176,9 @@ func (self *section) addSectionToBlockChain(p *peer) {
|
||||
|
||||
self.bp.status.lock.Lock()
|
||||
if err == nil {
|
||||
headKey := blocks[0].ParentHash().Str()
|
||||
headKey := blocks[0].ParentHash()
|
||||
height := self.bp.status.chain[headKey] + len(blocks)
|
||||
self.bp.status.chain[blocks[len(blocks)-1].Hash().Str()] = height
|
||||
self.bp.status.chain[blocks[len(blocks)-1].Hash()] = height
|
||||
if height > self.bp.status.values.LongestChain {
|
||||
self.bp.status.values.LongestChain = height
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user