storageminer: More correct listing of sealed sectors

This commit is contained in:
Łukasz Magiera 2019-10-30 10:55:49 +01:00
parent 922d8a90a5
commit 5a5c66600f
3 changed files with 21 additions and 16 deletions

View File

@ -114,10 +114,6 @@ func (sb *SectorBuilder) GetAllStagedSectors() ([]uint64, error) {
return out, nil
}
func (sb *SectorBuilder) GetAllSealedSectors() ([]SealedSectorMetadata, error) {
return sectorbuilder.GetAllSealedSectors(sb.handle)
}
func (sb *SectorBuilder) GeneratePoSt(sectorInfo SortedSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
// Wait, this is a blocking method with no way of interrupting it?
// does it checkpoint itself?

View File

@ -4,7 +4,6 @@ import (
"context"
"sync"
"github.com/filecoin-project/go-sectorbuilder/sealing_state"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log"
@ -118,15 +117,7 @@ func (m *Miner) commitUntrackedSectors(ctx context.Context) error {
log.Warnf("Missing commitment for sector %d, committing sector", s.SectorID)
if err := m.commitSector(ctx, sectorbuilder.SectorSealingStatus{
SectorID: s.SectorID,
State: sealing_state.Sealed,
CommD: s.CommD,
CommR: s.CommR,
Proof: s.Proof,
Pieces: s.Pieces,
Ticket: s.Ticket,
}); err != nil {
if err := m.commitSector(ctx, s); err != nil {
log.Error("Committing uncommitted sector failed: ", err)
}
}

View File

@ -293,8 +293,26 @@ func (s *Store) WaitSeal(ctx context.Context, sector uint64) (sectorbuilder.Sect
return s.sb.SealStatus(sector)
}
func (s *Store) Sealed() ([]sectorbuilder.SealedSectorMetadata, error) {
return s.sb.GetAllSealedSectors()
func (s *Store) Sealed() ([]sectorbuilder.SectorSealingStatus, error) {
l, err := s.sb.GetAllStagedSectors()
if err != nil {
return nil, err
}
out := make([]sectorbuilder.SectorSealingStatus, 0)
for _, sid := range l {
status, err := s.sb.SealStatus(sid)
if err != nil {
return nil, err
}
if status.State != sealing_state.Sealed {
continue
}
out = append(out, status)
}
return out, nil
}
func (s *Store) RunPoSt(ctx context.Context, sectors []*api.SectorInfo, r []byte, faults []uint64) ([]byte, error) {