From 1fe2d0d0e011b6d6bc6261b69fe955943d9d6e3e Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 24 Sep 2014 19:55:28 +0200 Subject: [PATCH] Peers no longer take care of block processing --- peer.go | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/peer.go b/peer.go index 8224f4831..3bbfb74fa 100644 --- a/peer.go +++ b/peer.go @@ -517,16 +517,9 @@ func (p *Peer) HandleInbound() { break } - blockPool.AddHash(hash) + blockPool.AddHash(hash, p) } - /* - if foundCommonHash || msg.Data.Len() == 0 { - p.FetchBlocks() - } else { - p.FetchHashes() - } - */ if !foundCommonHash && msg.Data.Len() != 0 { p.FetchHashes() } @@ -545,22 +538,6 @@ func (p *Peer) HandleInbound() { p.lastBlockReceived = time.Now() } - - /* - var err error - blockPool.CheckLinkAndProcess(func(block *ethchain.Block) { - err = p.ethereum.StateManager().Process(block, false) - }) - - if err != nil { - peerlogger.Infoln(err) - } else { - // Don't trigger if there's just one block. - if blockPool.Len() != 0 && msg.Data.Len() > 1 { - p.FetchBlocks() - } - } - */ } } } @@ -608,13 +585,6 @@ out: if sinceBlock > 5*time.Second && sinceHash > 5*time.Second { self.catchingUp = false } - - if sinceHash > 10*time.Second && self.ethereum.blockPool.Len() != 0 { - // XXX While this is completely and utterly incorrect, in order to do anything on the test net is to do it this way - // Assume that when fetching hashes timeouts, we are done. - //self.FetchHashes() - //self.FetchBlocks() - } } case <-self.quit: break out @@ -738,7 +708,7 @@ func (self *Peer) handleStatus(msg *ethwire.Msg) { // Compare the total TD with the blockchain TD. If remote is higher // fetch hashes from highest TD node. if self.td.Cmp(self.ethereum.BlockChain().TD) > 0 { - self.ethereum.blockPool.AddHash(self.lastReceivedHash) + self.ethereum.blockPool.AddHash(self.lastReceivedHash, self) self.FetchHashes() }