Disabled peer TD check to support suspended blocks (Future blocks)

@zelig When blocks are in the future they'll be cached and processed at
a later time. Because of this the returned TD will be much lower than
the broadcasted TD.
This commit is contained in:
obscuren 2015-04-04 16:24:22 +02:00
parent c985ce4d78
commit 0d1a9ce648
2 changed files with 6 additions and 6 deletions

View File

@ -761,10 +761,10 @@ func (self *BlockPool) checkTD(nodes ...*node) {
if n.td != nil { if n.td != nil {
plog.DebugDetailf("peer td %v =?= block td %v", n.td, n.block.Td) plog.DebugDetailf("peer td %v =?= block td %v", n.td, n.block.Td)
if n.td.Cmp(n.block.Td) != 0 { if n.td.Cmp(n.block.Td) != 0 {
self.peers.peerError(n.blockBy, ErrIncorrectTD, "on block %x", n.hash) //self.peers.peerError(n.blockBy, ErrIncorrectTD, "on block %x", n.hash)
self.status.lock.Lock() //self.status.lock.Lock()
self.status.badPeers[n.blockBy]++ //self.status.badPeers[n.blockBy]++
self.status.lock.Unlock() //self.status.lock.Unlock()
} }
} }
} }

View File

@ -477,8 +477,8 @@ func (self *peer) getBlockHashes() bool {
// XXX added currentBlock check (?) // XXX added currentBlock check (?)
if self.currentBlock != nil && self.currentBlock.Td != nil { if self.currentBlock != nil && self.currentBlock.Td != nil {
if self.td.Cmp(self.currentBlock.Td) != 0 { if self.td.Cmp(self.currentBlock.Td) != 0 {
self.addError(ErrIncorrectTD, "on block %x", self.currentBlockHash) //self.addError(ErrIncorrectTD, "on block %x", self.currentBlockHash)
self.bp.status.badPeers[self.id]++ //self.bp.status.badPeers[self.id]++
} }
} }
headKey := self.parentHash headKey := self.parentHash