oops peer unlocked before return - fixes deadlock

This commit is contained in:
zelig 2015-04-09 06:31:06 +01:00
parent 0e2bc23148
commit a009132c24
2 changed files with 2 additions and 0 deletions

View File

@ -384,6 +384,7 @@ func (self *BlockPool) AddBlockHashes(next func() (common.Hash, bool), peerId st
// first check if we are building the head section of a peer's chain
if bestpeer.parentHash == hash {
if self.hasBlock(bestpeer.currentBlockHash) {
bestpeer.lock.RUnlock()
return
}
/*

View File

@ -472,6 +472,7 @@ func (self *peer) getBlockHashes() bool {
} else {
// XXX added currentBlock check (?)
if self.currentBlock != nil && self.currentBlock.Td != nil && !self.currentBlock.Queued() {
plog.DebugDetailf("HeadSection: <%s> inserted %s to blockchain... check TD %v =?= %v", self.id, hex(self.parentHash), self.td, self.currentBlock.Td)
if self.td.Cmp(self.currentBlock.Td) != 0 {
self.addError(ErrIncorrectTD, "on block %x", self.currentBlockHash)
self.bp.status.badPeers[self.id]++