Skip to content

Commit 9a80cbd

Browse files
authored
fix: connection.BlockFetch().Client.GetBlock potential deadlock (#787)
1 parent 490f039 commit 9a80cbd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

protocol/blockfetch/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ func (c *Client) GetBlock(point common.Point) (ledger.Block, error) {
164164
}
165165
err, ok := <-c.startBatchResultChan
166166
if !ok {
167+
c.busyMutex.Unlock()
167168
return nil, protocol.ProtocolShuttingDownError
168169
}
169170
if err != nil {
@@ -172,6 +173,7 @@ func (c *Client) GetBlock(point common.Point) (ledger.Block, error) {
172173
}
173174
block, ok := <-c.blockChan
174175
if !ok {
176+
c.busyMutex.Unlock()
175177
return nil, protocol.ProtocolShuttingDownError
176178
}
177179
return block, nil

0 commit comments

Comments
 (0)