Do not allocate pieces that are bigger than a sector

This commit is contained in:
Aayush Rajasekaran 2020-06-18 14:19:30 -04:00
parent 379a4655b0
commit 5ad33896cc

View File

@ -91,6 +91,10 @@ func (m *Sealing) AllocatePiece(size abi.UnpaddedPieceSize) (sectorID abi.Sector
return 0, 0, xerrors.Errorf("cannot allocate unpadded piece") return 0, 0, xerrors.Errorf("cannot allocate unpadded piece")
} }
if size > abi.UnpaddedPieceSize(m.sealer.SectorSize()) {
return 0, 0, xerrors.Errorf("piece cannot fit into a sector")
}
sid, err := m.sc.Next() sid, err := m.sc.Next()
if err != nil { if err != nil {
return 0, 0, xerrors.Errorf("getting sector number: %w", err) return 0, 0, xerrors.Errorf("getting sector number: %w", err)