From b9ab33f0aeb9003247ff7cef48301f363e099e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 17 Sep 2019 10:40:13 +0200 Subject: [PATCH] storageminer: use switch in TrackCommitSectorMsg --- storage/commitment/tracker.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/storage/commitment/tracker.go b/storage/commitment/tracker.go index f1e85b898..dd0c1275d 100644 --- a/storage/commitment/tracker.go +++ b/storage/commitment/tracker.go @@ -54,11 +54,8 @@ func (ct *Tracker) TrackCommitSectorMsg(miner address.Address, sectorId uint64, defer ct.lk.Unlock() tracking, err := ct.commitDs.Get(key) - if err != datastore.ErrNotFound { - if err != nil { - return err - } - + switch err { + case datastore.ErrNotFound: var comm commitment if err := cbor.DecodeInto(tracking, &comm); err != nil { return err @@ -70,6 +67,10 @@ func (ct *Tracker) TrackCommitSectorMsg(miner address.Address, sectorId uint64, log.Warnf("commitment.TrackCommitSectorMsg called more than once for miner %s, sector %d, message %s", miner, sectorId, mcid) return nil + case nil: + break + default: + return err } comm := &commitment{Msg: mcid}