sealing: Validate piece alignment in checkPieces
This commit is contained in:
parent
332d83bd18
commit
ca790b4c69
@ -49,8 +49,15 @@ func checkPieces(ctx context.Context, maddr address.Address, sn abi.SectorNumber
|
||||
}
|
||||
|
||||
dealCount := 0
|
||||
var offset abi.PaddedPieceSize
|
||||
|
||||
for i, p := range pieces {
|
||||
// check that the piece is correctly aligned
|
||||
if offset%p.Piece.Size != 0 {
|
||||
return &ErrInvalidPiece{xerrors.Errorf("sector %d piece %d is not aligned: size=%xh offset=%xh off-by=%xh", sn, i, p.Piece.Size, offset, offset%p.Piece.Size)}
|
||||
}
|
||||
offset += p.Piece.Size
|
||||
|
||||
// if no deal is associated with the piece, ensure that we added it as
|
||||
// filler (i.e. ensure that it has a zero PieceCID)
|
||||
if p.DealInfo == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user