diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-07 17:18:46 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-07 17:18:46 +0800 |
commit | 0015ce1e353f52cca818d11f566b9a656fb85f24 (patch) | |
tree | cb14b0d81b0418e990276982b7f1ccf293ba1508 /peer.go | |
parent | 677836cbee1105043335c672b41dc4402e98c227 (diff) | |
download | go-tangerine-0015ce1e353f52cca818d11f566b9a656fb85f24.tar.gz go-tangerine-0015ce1e353f52cca818d11f566b9a656fb85f24.tar.zst go-tangerine-0015ce1e353f52cca818d11f566b9a656fb85f24.zip |
kick of bad peers
Diffstat (limited to 'peer.go')
-rw-r--r-- | peer.go | 26 |
1 files changed, 6 insertions, 20 deletions
@@ -516,10 +516,11 @@ func (p *Peer) HandleInbound() { blockPool.AddHash(hash, p) } - if !foundCommonHash && msg.Data.Len() != 0 { - if !p.FetchHashes() { - p.doneFetchingHashes = true - } + if !foundCommonHash { + //if !p.FetchHashes() { + // p.doneFetchingHashes = true + //} + p.FetchHashes() } else { peerlogger.Infof("Found common hash (%x...)\n", p.lastReceivedHash[0:4]) p.doneFetchingHashes = true @@ -533,8 +534,6 @@ func (p *Peer) HandleInbound() { it := msg.Data.NewIterator() for it.Next() { block := ethchain.NewBlockFromRlpValue(it.Value()) - //fmt.Printf("%v %x - %x\n", block.Number, block.Hash()[0:4], block.PrevHash[0:4]) - blockPool.Add(block, p) p.lastBlockReceived = time.Now() @@ -557,21 +556,8 @@ func (self *Peer) FetchBlocks(hashes [][]byte) { func (self *Peer) FetchHashes() bool { blockPool := self.ethereum.blockPool - return blockPool.FetchHashes(self) - - /* - if self.td.Cmp(self.ethereum.HighestTDPeer()) >= 0 { - blockPool.td = self.td - if !blockPool.HasLatestHash() { - self.doneFetchingHashes = false - - const amount = 256 - peerlogger.Debugf("Fetching hashes (%d)\n", amount) - self.QueueMessage(ethwire.NewMessage(ethwire.MsgGetBlockHashesTy, []interface{}{self.lastReceivedHash, uint32(amount)})) - } - } - */ + return blockPool.FetchHashes(self) } func (self *Peer) FetchingHashes() bool { |