Merge pull request #9353 from filecoin-project/gstuart/retrieval-calculation-fix

fix: retrievals: price-per-byte calculation fix
This commit is contained in:
Aayush Rajasekaran 2022-09-21 15:50:47 -04:00 committed by GitHub
commit 24c536fed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -837,7 +837,7 @@ func (a *API) doRetrieval(ctx context.Context, order api.RetrievalOrder, sel dat
return 0, xerrors.Errorf("cannot make retrieval deal for zero bytes") return 0, xerrors.Errorf("cannot make retrieval deal for zero bytes")
} }
ppb := types.BigDiv(order.Total, types.NewInt(order.Size)) ppb := types.BigDiv(big.Sub(order.Total, order.UnsealPrice), types.NewInt(order.Size))
params, err := rm.NewParamsV1(ppb, order.PaymentInterval, order.PaymentIntervalIncrease, sel, order.Piece, order.UnsealPrice) params, err := rm.NewParamsV1(ppb, order.PaymentInterval, order.PaymentIntervalIncrease, sel, order.Piece, order.UnsealPrice)
if err != nil { if err != nil {