prevent client list-deals from crashing
This commit is contained in:
parent
5730d46179
commit
8f6c3c2cc7
@ -501,16 +501,27 @@ var clientListDeals = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var deals []deal
|
var deals []deal
|
||||||
for idx := range localDeals {
|
for _, v := range localDeals {
|
||||||
onChain, err := api.StateMarketStorageDeal(ctx, localDeals[idx].DealID, head.Key())
|
if v.DealID == 0 {
|
||||||
if err != nil {
|
deals = append(deals, deal{
|
||||||
return err
|
LocalDeal: v,
|
||||||
}
|
OnChainDealState: market.DealState{
|
||||||
|
SectorStartEpoch: -1,
|
||||||
|
LastUpdatedEpoch: -1,
|
||||||
|
SlashEpoch: -1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
onChain, err := api.StateMarketStorageDeal(ctx, v.DealID, head.Key())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
deals = append(deals, deal{
|
deals = append(deals, deal{
|
||||||
LocalDeal: localDeals[idx],
|
LocalDeal: v,
|
||||||
OnChainDealState: onChain.State,
|
OnChainDealState: onChain.State,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user