Merge pull request #5160 from iand/fix/unlock-event-mutex

fix(events): unlock mutex before error returns
This commit is contained in:
Łukasz Magiera 2020-12-09 19:25:07 +01:00 committed by GitHub
commit bc9b5cb5fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()