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(), BaseCID: channelState.BaseCID(),
IsSender: channelState.Sender() == hostID, IsSender: channelState.Sender() == hostID,
Message: channelState.Message(), Message: channelState.Message(),
Stages: channelState.Stages(),
} }
stringer, ok := channelState.Voucher().(fmt.Stringer) stringer, ok := channelState.Voucher().(fmt.Stringer)
if ok { 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") 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) renderDeal(di)
return nil 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 // be not found if it's no longer active
if err == nil { if err == nil {
ch := api.NewDataTransferChannel(a.Host.ID(), state) ch := api.NewDataTransferChannel(a.Host.ID(), state)
ch.Stages = state.Stages()
transferCh = &ch 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 { 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, Verified: v.Proposal.VerifiedDeal,
TransferChannelID: v.TransferChannelID, TransferChannelID: v.TransferChannelID,
DataTransfer: transferCh, DataTransfer: transferCh,
DealStages: v.DealStages,
} }
} }