X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=protocol%2Fprotocol.go;fp=protocol%2Fprotocol.go;h=314b56830ed1d85bc5eaba99b7721ccbeaeccd17;hb=101539186ad6a4422b703abf5f8739f26c7a21f3;hp=d7ea94484e8986833e1f2143f3b95e2fcd524dac;hpb=3fd8afc8c8f3e63807d525a073f81d061cbade6d;p=bytom%2Fvapor.git diff --git a/protocol/protocol.go b/protocol/protocol.go index d7ea9448..314b5683 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -201,9 +201,7 @@ func (c *Chain) setState(blockHeader, irrBlockHeader *types.BlockHeader, mainBlo func (c *Chain) BlockWaiter(height uint64) <-chan struct{} { ch := make(chan struct{}, 1) go func() { - c.cond.L.Lock() - defer c.cond.L.Unlock() - for c.bestBlockHeader.Height < height { + for bestHeight := c.BestBlockHeight(); bestHeight < height; bestHeight = c.BestBlockHeight() { c.cond.Wait() } ch <- struct{}{}