diff --git a/storagemarket/impl/providerstates/provider_states.go b/storagemarket/impl/providerstates/provider_states.go index 60794ce6..35cc52ab 100644 --- a/storagemarket/impl/providerstates/provider_states.go +++ b/storagemarket/impl/providerstates/provider_states.go @@ -309,7 +309,7 @@ func HandoffDeal(ctx fsm.Context, environment ProviderDealEnvironment, deal stor } // Hand the deal off to the process that adds it to a sector - packingInfo, err = handoffDeal(ctx.Context(), environment, deal, file, uint64(file.Size())) + packingInfo, err = handoffDeal(ctx.Context(), environment, deal, file, uint64(file.Size()), deal.Proposal.PieceSize) if err != nil { err = xerrors.Errorf("packing piece at path %s: %w", deal.PiecePath, err) return ctx.Trigger(storagemarket.ProviderEventDealHandoffFailed, err) @@ -324,7 +324,7 @@ func HandoffDeal(ctx fsm.Context, environment ProviderDealEnvironment, deal stor // Hand the deal off to the process that adds it to a sector var packingErr error - packingInfo, packingErr = handoffDeal(ctx.Context(), environment, deal, pieceReader, pieceSize) + packingInfo, packingErr = handoffDeal(ctx.Context(), environment, deal, pieceReader, pieceSize, deal.Proposal.PieceSize) // Close the read side of the pipe err = pieceReader.Close() @@ -360,8 +360,8 @@ func HandoffDeal(ctx fsm.Context, environment ProviderDealEnvironment, deal stor return ctx.Trigger(storagemarket.ProviderEventDealHandedOff) } -func handoffDeal(ctx context.Context, environment ProviderDealEnvironment, deal storagemarket.MinerDeal, reader io.Reader, size uint64) (*storagemarket.PackingResult, error) { - paddedReader, paddedSize := padreader.New(reader, size) +func handoffDeal(ctx context.Context, environment ProviderDealEnvironment, deal storagemarket.MinerDeal, reader io.Reader, payloadSize uint64, pieceSize abi.PaddedPieceSize) (*storagemarket.PackingResult, error) { + paddedReader, _ := padreader.New(reader, payloadSize) return environment.Node().OnDealComplete( ctx, storagemarket.MinerDeal{ @@ -374,7 +374,7 @@ func handoffDeal(ctx context.Context, environment ProviderDealEnvironment, deal DealID: deal.DealID, FastRetrieval: deal.FastRetrieval, }, - paddedSize, + pieceSize.Unpadded(), paddedReader, ) }