diff --git a/storagemarket/impl/client_states.go b/storagemarket/impl/client_states.go index 46f8d7e8..6c0f52f9 100644 --- a/storagemarket/impl/client_states.go +++ b/storagemarket/impl/client_states.go @@ -76,7 +76,7 @@ func (c *Client) staged(ctx context.Context, deal ClientDeal) (func(*ClientDeal) } func (c *Client) sealing(ctx context.Context, deal ClientDeal) (func(*ClientDeal), error) { - cb := func(err error) { + cb := func(_ uint64, err error) { select { case c.updated <- clientDealUpdate{ newState: storagemarket.StorageDealActive, diff --git a/storagemarket/impl/provider_states.go b/storagemarket/impl/provider_states.go index 971bbe93..148adcc7 100644 --- a/storagemarket/impl/provider_states.go +++ b/storagemarket/impl/provider_states.go @@ -177,7 +177,7 @@ func (p *Provider) staged(ctx context.Context, deal MinerDeal) (func(*MinerDeal) return nil, err } paddedReader, paddedSize := padreader.NewPaddedReader(file, uint64(file.Size())) - sectorID, err := p.spn.OnDealComplete( + err = p.spn.OnDealComplete( ctx, storagemarket.MinerDeal{ Client: deal.Client, @@ -191,25 +191,22 @@ func (p *Provider) staged(ctx context.Context, deal MinerDeal) (func(*MinerDeal) paddedReader, ) - if err != nil { - return nil, err - } - - return func(deal *MinerDeal) { - deal.SectorID = sectorID - }, nil + return nil, err } // SEALING func (p *Provider) sealing(ctx context.Context, deal MinerDeal) (func(*MinerDeal), error) { // TODO: consider waiting for seal to happen - cb := func(err error) { + cb := func(sectorId uint64, err error) { select { case p.updated <- minerDealUpdate{ newState: storagemarket.StorageDealActive, id: deal.ProposalCid, err: err, + mut: func(deal *MinerDeal) { + deal.SectorID = sectorId + }, }: case <-p.stop: } diff --git a/storagemarket/types.go b/storagemarket/types.go index be976d81..3ab6161b 100644 --- a/storagemarket/types.go +++ b/storagemarket/types.go @@ -231,8 +231,7 @@ type StorageProviderNode interface { ListProviderDeals(ctx context.Context, addr address.Address) ([]StorageDeal, error) // Called when a deal is complete and on chain, and data has been transferred and is ready to be added to a sector - // returns sector id - OnDealComplete(ctx context.Context, deal MinerDeal, pieceSize uint64, pieceReader io.Reader) (uint64, error) + OnDealComplete(ctx context.Context, deal MinerDeal, pieceSize uint64, pieceReader io.Reader) error // returns the worker address associated with a miner GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) @@ -245,7 +244,7 @@ type StorageProviderNode interface { LocatePieceForDealWithinSector(ctx context.Context, dealID uint64) (sectorID uint64, offset uint64, length uint64, err error) } -type DealSectorCommittedCallback func(error) +type DealSectorCommittedCallback func(sectorId uint64, err error) // Node dependencies for a StorageClient type StorageClientNode interface {