storageminer: use switch in TrackCommitSectorMsg

This commit is contained in:
Łukasz Magiera 2019-09-17 10:40:13 +02:00
parent 8f84aa7097
commit b9ab33f0ae

View File

@ -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}