From 42df84b6be8a9510ec832b53277c1634ec613fe8 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Thu, 18 Feb 2021 21:45:33 -0800 Subject: [PATCH] price specification by user should match what miner has in their ask --- storagemarket/impl/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storagemarket/impl/client.go b/storagemarket/impl/client.go index c3ff4e6c..a6f0031c 100644 --- a/storagemarket/impl/client.go +++ b/storagemarket/impl/client.go @@ -338,6 +338,8 @@ func (c *Client) ProposeStorageDeal(ctx context.Context, params storagemarket.Pr return nil, xerrors.Errorf("computing commP failed: %w", err) } + pricePerEpoch := big.Mul(big.NewInt(int64(pieceSize.Padded())), params.Price) + if uint64(pieceSize.Padded()) > params.Info.SectorSize { return nil, fmt.Errorf("cannot propose a deal whose piece size (%d) is greater than sector size (%d)", pieceSize.Padded(), params.Info.SectorSize) } @@ -363,7 +365,7 @@ func (c *Client) ProposeStorageDeal(ctx context.Context, params storagemarket.Pr Label: label, StartEpoch: params.StartEpoch, EndEpoch: params.EndEpoch, - StoragePricePerEpoch: params.Price, + StoragePricePerEpoch: pricePerEpoch, ProviderCollateral: pcMin, ClientCollateral: big.Zero(), VerifiedDeal: params.VerifiedDeal,