Merge pull request #210 from filecoin-project/fix/commit-track
fix error handling in track commit sector msg
This commit is contained in:
commit
88068b1cf4
@ -56,23 +56,6 @@ func (ct *Tracker) TrackCommitSectorMsg(miner address.Address, sectorId uint64,
|
|||||||
tracking, err := ct.commitDs.Get(key)
|
tracking, err := ct.commitDs.Get(key)
|
||||||
switch err {
|
switch err {
|
||||||
case datastore.ErrNotFound:
|
case datastore.ErrNotFound:
|
||||||
var comm commitment
|
|
||||||
if err := cbor.DecodeInto(tracking, &comm); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !comm.Msg.Equals(mcid) {
|
|
||||||
return xerrors.Errorf("commitment tracking for miner %s, sector %d: already tracking %s, got another commitment message: %s", miner, sectorId, comm.Msg, mcid)
|
|
||||||
}
|
|
||||||
|
|
||||||
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}
|
comm := &commitment{Msg: mcid}
|
||||||
commB, err := cbor.DumpObject(comm)
|
commB, err := cbor.DumpObject(comm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -88,8 +71,22 @@ func (ct *Tracker) TrackCommitSectorMsg(miner address.Address, sectorId uint64,
|
|||||||
close(waits)
|
close(waits)
|
||||||
delete(ct.waits, key)
|
delete(ct.waits, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
case nil:
|
||||||
|
var comm commitment
|
||||||
|
if err := cbor.DecodeInto(tracking, &comm); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !comm.Msg.Equals(mcid) {
|
||||||
|
return xerrors.Errorf("commitment tracking for miner %s, sector %d: already tracking %s, got another commitment message: %s", miner, sectorId, comm.Msg, mcid)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Warnf("commitment.TrackCommitSectorMsg called more than once for miner %s, sector %d, message %s", miner, sectorId, mcid)
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ct *Tracker) WaitCommit(ctx context.Context, miner address.Address, sectorId uint64) (cid.Cid, error) {
|
func (ct *Tracker) WaitCommit(ctx context.Context, miner address.Address, sectorId uint64) (cid.Cid, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user