Propose Deal: Fail early if data doesn't fit in a sector
This commit is contained in:
parent
14ad808a00
commit
4a93ad33f9
@ -90,12 +90,16 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams)
|
|||||||
return nil, xerrors.Errorf("failed checking miners sector size: %w", err)
|
return nil, xerrors.Errorf("failed checking miners sector size: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if uint64(params.Data.PieceSize.Padded()) > uint64(ssize) {
|
||||||
|
return nil, xerrors.New("data doesn't fit in a sector")
|
||||||
|
}
|
||||||
|
|
||||||
rt, _, err := ffiwrapper.ProofTypeFromSectorSize(ssize)
|
rt, _, err := ffiwrapper.ProofTypeFromSectorSize(ssize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("bad sector size: %w", err)
|
return nil, xerrors.Errorf("bad sector size: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
providerInfo := utils.NewStorageProviderInfo(params.Miner, mw, 0, pid)
|
providerInfo := utils.NewStorageProviderInfo(params.Miner, mw, ssize, pid)
|
||||||
ts, err := a.ChainHead(ctx)
|
ts, err := a.ChainHead(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed getting chain height: %w", err)
|
return nil, xerrors.Errorf("failed getting chain height: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user