Skip to content

Commit

Permalink
fix: connection.BlockFetch().Client.GetBlock potential deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Newt6611 committed Nov 11, 2024
1 parent f07ac1a commit ca9cf22
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions protocol/blockfetch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (c *Client) GetBlock(point common.Point) (ledger.Block, error) {
}
err, ok := <-c.startBatchResultChan
if !ok {
c.busyMutex.Unlock()
return nil, protocol.ProtocolShuttingDownError
}
if err != nil {
Expand All @@ -172,6 +173,7 @@ func (c *Client) GetBlock(point common.Point) (ledger.Block, error) {
}
block, ok := <-c.blockChan
if !ok {
c.busyMutex.Unlock()
return nil, protocol.ProtocolShuttingDownError
}
return block, nil
Expand Down

0 comments on commit ca9cf22

Please sign in to comment.