From a009132c2429adca5ba058f46c0a460b287a4407 Mon Sep 17 00:00:00 2001 From: zelig Date: Thu, 9 Apr 2015 06:31:06 +0100 Subject: [PATCH] oops peer unlocked before return - fixes deadlock --- blockpool/blockpool.go | 1 + blockpool/peers.go | 1 + 2 files changed, 2 insertions(+) diff --git a/blockpool/blockpool.go b/blockpool/blockpool.go index 2340eadae2..7a65768c7a 100644 --- a/blockpool/blockpool.go +++ b/blockpool/blockpool.go @@ -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 } /* diff --git a/blockpool/peers.go b/blockpool/peers.go index 8a52545dfb..6109ca4b46 100644 --- a/blockpool/peers.go +++ b/blockpool/peers.go @@ -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]++