include Stages and DealStages only on ClientDealInfo, not on ClientListDeals

This commit is contained in:
Anton Evangelatov 2021-04-01 16:57:39 +03:00
parent 686c719bb1
commit df003d44d2
3 changed files with 11 additions and 3 deletions

View File

@ -72,7 +72,6 @@ func NewDataTransferChannel(hostID peer.ID, channelState datatransfer.ChannelSta
BaseCID: channelState.BaseCID(),
IsSender: channelState.Sender() == hostID,
Message: channelState.Message(),
Stages: channelState.Stages(),
}
stringer, ok := channelState.Voucher().(fmt.Stringer)
if ok {

View File

@ -2302,6 +2302,12 @@ func inspectDealCmd(ctx context.Context, api lapi.FullNode, proposalCid string,
return errors.New("you must specify proposal cid or deal id in order to inspect a deal")
}
// populate DealInfo.DealStages and DataTransfer.Stages
di, err = api.ClientGetDealInfo(ctx, di.ProposalCid)
if err != nil {
return fmt.Errorf("cannot get deal info for proposal cid: %v", di.ProposalCid)
}
renderDeal(di)
return nil

View File

@ -267,10 +267,14 @@ func (a *API) newDealInfo(ctx context.Context, v storagemarket.ClientDeal) api.D
// be not found if it's no longer active
if err == nil {
ch := api.NewDataTransferChannel(a.Host.ID(), state)
ch.Stages = state.Stages()
transferCh = &ch
}
}
return a.newDealInfoWithTransfer(transferCh, v)
di := a.newDealInfoWithTransfer(transferCh, v)
di.DealStages = v.DealStages
return di
}
func (a *API) newDealInfoWithTransfer(transferCh *api.DataTransferChannel, v storagemarket.ClientDeal) api.DealInfo {
@ -289,7 +293,6 @@ func (a *API) newDealInfoWithTransfer(transferCh *api.DataTransferChannel, v sto
Verified: v.Proposal.VerifiedDeal,
TransferChannelID: v.TransferChannelID,
DataTransfer: transferCh,
DealStages: v.DealStages,
}
}