aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-04-13 03:25:09 +0800
committerzelig <viktor.tron@gmail.com>2015-04-13 20:13:55 +0800
commit3d57e377a4e95941fd3f572b42e073b40d10d27c (patch)
tree95807260bab2e43c6929d6d4b5c05144ed2fd5c9 /eth/protocol.go
parentfaa2747809ddce7e7b121926ae7dece8fbecae52 (diff)
downloaddexon-3d57e377a4e95941fd3f572b42e073b40d10d27c.tar.gz
dexon-3d57e377a4e95941fd3f572b42e073b40d10d27c.tar.zst
dexon-3d57e377a4e95941fd3f572b42e073b40d10d27c.zip
blockpool stability fixes:
- follow up locks and fix them - chainManager: call SetQueued for parentErr future blocks, uncomment TD checks, unskip test - make ErrIncorrectTD non-fatal to be forgiving to genuine mistaken nodes (temp) but demote them to guard against stuck best peers. - add purging to bounded nodeCache (config nodeCacheSize) - use nodeCache when creating blockpool entries and let non-best peers add blocks (performance boost) - minor error in addError - reduce idleBestPeerTimeout to 1 minute - correct status counts and unskip status passing status test - glogified logging
Diffstat (limited to 'eth/protocol.go')
-rw-r--r--eth/protocol.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/eth/protocol.go b/eth/protocol.go
index 878038f74..1a19307db 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -299,7 +299,7 @@ func (self *ethProtocol) handle() error {
// to simplify backend interface adding a new block
// uses AddPeer followed by AddBlock only if peer is the best peer
// (or selected as new best peer)
- if best, _ := self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect); best {
+ if _, suspended := self.blockPool.AddPeer(request.TD, hash, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect); !suspended {
self.blockPool.AddBlock(request.Block, self.id)
}
@@ -384,11 +384,9 @@ func (self *ethProtocol) sendStatus() error {
}
func (self *ethProtocol) protoErrorDisconnect(err *errs.Error) {
- //err.Log(self.peer.Logger)
err.Log(glog.V(logger.Info))
- /*
- if err.Fatal() {
- self.peer.Disconnect(p2p.DiscSubprotocolError)
- }
- */
+ if err.Fatal() {
+ self.peer.Disconnect(p2p.DiscSubprotocolError)
+ }
+
}