diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-20 18:29:02 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-20 18:29:02 +0800 |
commit | 45da3e17e2ada226d7c82db667d263f8e004cbfc (patch) | |
tree | 627499fa3e24bbe70ed5c0c526d30d713205b106 /eth | |
parent | 52584596d4c9cee7adcc1c343addd19279aaac84 (diff) | |
download | go-tangerine-45da3e17e2ada226d7c82db667d263f8e004cbfc.tar go-tangerine-45da3e17e2ada226d7c82db667d263f8e004cbfc.tar.gz go-tangerine-45da3e17e2ada226d7c82db667d263f8e004cbfc.tar.bz2 go-tangerine-45da3e17e2ada226d7c82db667d263f8e004cbfc.tar.lz go-tangerine-45da3e17e2ada226d7c82db667d263f8e004cbfc.tar.xz go-tangerine-45da3e17e2ada226d7c82db667d263f8e004cbfc.tar.zst go-tangerine-45da3e17e2ada226d7c82db667d263f8e004cbfc.zip |
core: added chain head reset to known block
Diffstat (limited to 'eth')
-rw-r--r-- | eth/downloader/downloader.go | 2 | ||||
-rw-r--r-- | eth/handler.go | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index addcbcc44..cfc494b2f 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -472,6 +472,8 @@ func (d *Downloader) process() error { } break } else if err != nil { + // immediatly unregister the false peer but do not disconnect + d.UnregisterPeer(d.activePeer) // Reset chain completely. This needs much, much improvement. // instead: check all blocks leading down to this block false block and remove it blocks = nil diff --git a/eth/handler.go b/eth/handler.go index 5c0660d84..622f22132 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -36,6 +36,7 @@ pm.chainman.InsertChain(blocks) import ( "fmt" + "math" "math/big" "sync" @@ -326,7 +327,7 @@ func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block) } // Broadcast block to peer set // XXX due to the current shit state of the network disable the limit - //peers = peers[:int(math.Sqrt(float64(len(peers))))] + peers = peers[:int(math.Sqrt(float64(len(peers))))] for _, peer := range peers { peer.sendNewBlock(block) } |