aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-25 01:55:28 +0800
committerobscuren <geffobscura@gmail.com>2014-09-25 01:55:28 +0800
commit1fe2d0d0e011b6d6bc6261b69fe955943d9d6e3e (patch)
tree12f89e2a14e0a980da2991ca64153f52ddf8c05b
parent54558dd8ae55fc2c7e226c908222803671b7feeb (diff)
downloaddexon-1fe2d0d0e011b6d6bc6261b69fe955943d9d6e3e.tar.gz
dexon-1fe2d0d0e011b6d6bc6261b69fe955943d9d6e3e.tar.zst
dexon-1fe2d0d0e011b6d6bc6261b69fe955943d9d6e3e.zip
Peers no longer take care of block processing
-rw-r--r--peer.go34
1 files 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()
}