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.
pull/632/merge
obscuren 10 years ago
parent c985ce4d78
commit 0d1a9ce648
  1. 8
      blockpool/blockpool.go
  2. 4
      blockpool/peers.go

@ -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()
} }
} }
} }

@ -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

Loading…
Cancel
Save