fsm: fail early on too-many-sealing-sectors in pledge
This commit is contained in:
parent
e7d65be90a
commit
6a7d72c030
11
extern/storage-sealing/garbage.go
vendored
11
extern/storage-sealing/garbage.go
vendored
@ -31,6 +31,17 @@ func (m *Sealing) pledgeSector(ctx context.Context, sectorID abi.SectorID, exist
|
||||
}
|
||||
|
||||
func (m *Sealing) PledgeSector() error {
|
||||
cfg, err := m.getConfig()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting config: %w", err)
|
||||
}
|
||||
|
||||
if cfg.MaxSealingSectors > 0 {
|
||||
if m.stats.curSealing() > cfg.MaxSealingSectors {
|
||||
return xerrors.Errorf("too many sectors sealing (curSealing: %d, max: %d)", m.stats.curSealing(), cfg.MaxSealingSectors)
|
||||
}
|
||||
}
|
||||
|
||||
go func() {
|
||||
ctx := context.TODO() // we can't use the context from command which invokes
|
||||
// this, as we run everything here async, and it's cancelled when the
|
||||
|
11
extern/storage-sealing/sealing.go
vendored
11
extern/storage-sealing/sealing.go
vendored
@ -361,17 +361,6 @@ func (m *Sealing) newDealSector() (abi.SectorNumber, error) {
|
||||
|
||||
// newSectorCC accepts a slice of pieces with no deal (junk data)
|
||||
func (m *Sealing) newSectorCC(sid abi.SectorNumber, pieces []Piece) error {
|
||||
cfg, err := m.getConfig()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting config: %w", err)
|
||||
}
|
||||
|
||||
if cfg.MaxSealingSectors > 0 {
|
||||
if m.stats.curSealing() > cfg.MaxSealingSectors {
|
||||
return xerrors.Errorf("too many sectors sealing (curSealing: %d, max: %d)", m.stats.curSealing(), cfg.MaxSealingSectors)
|
||||
}
|
||||
}
|
||||
|
||||
rt, err := ffiwrapper.SealProofTypeFromSectorSize(m.sealer.SectorSize())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("bad sector size: %w", err)
|
||||
|
Loading…
Reference in New Issue
Block a user