sealing: ComputeDataCid review
This commit is contained in:
parent
a2d90625d2
commit
779e923854
10
extern/sector-storage/ffiwrapper/sealer_cgo.go
vendored
10
extern/sector-storage/ffiwrapper/sealer_cgo.go
vendored
@ -58,14 +58,6 @@ func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize,
|
|||||||
|
|
||||||
maxSizeSpt := abi.RegisteredSealProof_StackedDrg64GiBV1_1
|
maxSizeSpt := abi.RegisteredSealProof_StackedDrg64GiBV1_1
|
||||||
|
|
||||||
var done func()
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
if done != nil {
|
|
||||||
done()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
throttle := make(chan []byte, parallel)
|
throttle := make(chan []byte, parallel)
|
||||||
piecePromises := make([]func() (abi.PieceInfo, error), 0)
|
piecePromises := make([]func() (abi.PieceInfo, error), 0)
|
||||||
|
|
||||||
@ -123,7 +115,7 @@ func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return abi.PieceInfo{
|
return abi.PieceInfo{
|
||||||
Size: abi.UnpaddedPieceSize(len(buf[:read])).Padded(),
|
Size: abi.UnpaddedPieceSize(read).Padded(),
|
||||||
PieceCID: e.Cid,
|
PieceCID: e.Cid,
|
||||||
}, nil
|
}, nil
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
@ -54,6 +54,12 @@ func TestWorkerDataCid(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, abi.PaddedPieceSize(1024), pi.Size)
|
require.Equal(t, abi.PaddedPieceSize(1024), pi.Size)
|
||||||
require.Equal(t, "baga6ea4seaqlhznlutptgfwhffupyer6txswamerq5fc2jlwf2lys2mm5jtiaeq", pi.PieceCID.String())
|
require.Equal(t, "baga6ea4seaqlhznlutptgfwhffupyer6txswamerq5fc2jlwf2lys2mm5jtiaeq", pi.PieceCID.String())
|
||||||
|
|
||||||
|
bigPiece := abi.PaddedPieceSize(16 << 20).Unpadded()
|
||||||
|
pi, err = miner.ComputeDataCid(ctx, bigPiece, strings.NewReader(strings.Repeat("a", int(bigPiece))))
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, bigPiece.Padded(), pi.Size)
|
||||||
|
require.Equal(t, "baga6ea4seaqmhoxl2ybw5m2wyd3pt3h4zmp7j52yumzu2rar26twns3uocq7yfa", pi.PieceCID.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWinningPostWorker(t *testing.T) {
|
func TestWinningPostWorker(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user