OSDN Git Service
(root)
/
bytom
/
vapor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3fd8afc
)
Fix BlockWaiter dead lock (#311)
author
yahtoo
<yahtoo.ma@gmail.com>
Thu, 18 Jul 2019 06:58:50 +0000
(14:58 +0800)
committer
Paladz
<yzhu101@uottawa.ca>
Thu, 18 Jul 2019 06:58:50 +0000
(14:58 +0800)
* Fix BlockWaiter dead lock
* Opz name of the variable
protocol/protocol.go
patch
|
blob
|
history
diff --git
a/protocol/protocol.go
b/protocol/protocol.go
index
d7ea944
..
314b568
100644
(file)
--- 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{}{}