From 9a80cbd4774836906d6aa8c4fbf98514c12aa3e4 Mon Sep 17 00:00:00 2001 From: Newt6611 <45097780+Newt6611@users.noreply.github.com> Date: Tue, 12 Nov 2024 04:36:42 +0800 Subject: [PATCH] fix: connection.BlockFetch().Client.GetBlock potential deadlock (#787) --- protocol/blockfetch/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protocol/blockfetch/client.go b/protocol/blockfetch/client.go index e9f688d8..f581692a 100644 --- a/protocol/blockfetch/client.go +++ b/protocol/blockfetch/client.go @@ -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 { @@ -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