zerocomm: 'Fix' the test

This commit is contained in:
Łukasz Magiera 2020-02-27 01:54:39 +01:00
parent d1c15a2666
commit cec0b3c15f

View File

@ -7,19 +7,12 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/lotus/lib/nullreader"
) )
type nullReader struct{}
func (nullReader) Read(out []byte) (int, error) {
for i := range out {
out[i] = 0
}
return len(out), nil
}
func (m *Sealing) pledgeReader(size abi.UnpaddedPieceSize) io.Reader { func (m *Sealing) pledgeReader(size abi.UnpaddedPieceSize) io.Reader {
return io.LimitReader(&nullReader{}, int64(size)) return io.LimitReader(&nullreader.Reader{}, int64(size))
} }
func (m *Sealing) pledgeSector(ctx context.Context, sectorID abi.SectorNumber, existingPieceSizes []abi.UnpaddedPieceSize, sizes ...abi.UnpaddedPieceSize) ([]Piece, error) { func (m *Sealing) pledgeSector(ctx context.Context, sectorID abi.SectorNumber, existingPieceSizes []abi.UnpaddedPieceSize, sizes ...abi.UnpaddedPieceSize) ([]Piece, error) {