aboutsummaryrefslogtreecommitdiffstats
path: root/blockpool/section.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-21 04:52:29 +0800
committerzelig <viktor.tron@gmail.com>2015-03-22 10:02:24 +0800
commit95038fc62dc73da3f04bd37c0bdc29170eec0169 (patch)
treea15ca6c085ac20e201eef3f386521ab1df9eed14 /blockpool/section.go
parent7f85608f30a2e34005c8d15566849229c758c2f1 (diff)
downloaddexon-95038fc62dc73da3f04bd37c0bdc29170eec0169.tar.gz
dexon-95038fc62dc73da3f04bd37c0bdc29170eec0169.tar.zst
dexon-95038fc62dc73da3f04bd37c0bdc29170eec0169.zip
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
Diffstat (limited to 'blockpool/section.go')
-rw-r--r--blockpool/section.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/blockpool/section.go b/blockpool/section.go
index bcbd71cfc..14e91cf33 100644
--- a/blockpool/section.go
+++ b/blockpool/section.go
@@ -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
}