diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-21 04:52:29 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-22 10:02:24 +0800 |
commit | 95038fc62dc73da3f04bd37c0bdc29170eec0169 (patch) | |
tree | a15ca6c085ac20e201eef3f386521ab1df9eed14 /blockpool/status.go | |
parent | 7f85608f30a2e34005c8d15566849229c758c2f1 (diff) | |
download | dexon-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/status.go')
-rw-r--r-- | blockpool/status.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/blockpool/status.go b/blockpool/status.go index 4529c77fe..02e358510 100644 --- a/blockpool/status.go +++ b/blockpool/status.go @@ -3,6 +3,8 @@ package blockpool import ( "fmt" "sync" + + "github.com/ethereum/go-ethereum/common" ) type statusValues struct { @@ -26,7 +28,7 @@ type statusValues struct { type status struct { lock sync.Mutex values statusValues - chain map[string]int + chain map[common.Hash]int peers map[string]int bestPeers map[string]int badPeers map[string]int @@ -35,7 +37,7 @@ type status struct { func newStatus() *status { return &status{ - chain: make(map[string]int), + chain: make(map[common.Hash]int), peers: make(map[string]int), bestPeers: make(map[string]int), badPeers: make(map[string]int), |