aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-07 17:18:46 +0800
committerobscuren <geffobscura@gmail.com>2014-10-07 17:18:46 +0800
commit0015ce1e353f52cca818d11f566b9a656fb85f24 (patch)
treecb14b0d81b0418e990276982b7f1ccf293ba1508 /peer.go
parent677836cbee1105043335c672b41dc4402e98c227 (diff)
downloadgo-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.go26
1 files changed, 6 insertions, 20 deletions
diff --git a/peer.go b/peer.go
index 763658dd5..63def37ed 100644
--- a/peer.go
+++ b/peer.go
@@ -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 {