From c6f5214657438aab4ba0d5e6c0c44ba831c7ffef Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Wed, 9 Dec 2020 13:37:56 +0000 Subject: [PATCH] fix(events): unlock mutex before error returns --- chain/events/events_height.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chain/events/events_height.go b/chain/events/events_height.go index c8dd905d9b1..1fcff9e68f1 100644 --- a/chain/events/events_height.go +++ b/chain/events/events_height.go @@ -153,6 +153,7 @@ func (e *heightEvents) ChainAt(hnd HeightHandler, rev RevertHandler, confidence best, err := e.tsc.best() if err != nil { + e.lk.Unlock() return xerrors.Errorf("error getting best tipset: %w", err) } @@ -177,6 +178,7 @@ func (e *heightEvents) ChainAt(hnd HeightHandler, rev RevertHandler, confidence e.lk.Lock() best, err = e.tsc.best() if err != nil { + e.lk.Unlock() return xerrors.Errorf("error getting best tipset: %w", err) } bestH = best.Height()