Handle bad peerIDs in MarketListRetrievalDeals

This commit is contained in:
Łukasz Magiera 2021-07-08 19:27:03 +02:00
parent 10825e3a95
commit ed0cc0b56d
2 changed files with 6 additions and 1 deletions

View File

@ -283,7 +283,7 @@ func infoCmdAct(cctx *cli.Context) error {
return sorted[i].status > sorted[j].status
})
fmt.Printf("Deals: %d, %s\n", total.count, types.SizeStr(types.NewInt(uint64(total.bytes))))
fmt.Printf("Storage Deals: %d, %s\n", total.count, types.SizeStr(types.NewInt(uint64(total.bytes))))
tw := tabwriter.NewWriter(os.Stdout, 1, 1, 1, ' ', 0)
for _, e := range sorted {
_, _ = tw.Write([]byte(e.str))

View File

@ -454,6 +454,11 @@ func (sm *StorageMinerAPI) MarketListRetrievalDeals(ctx context.Context) ([]retr
deals := sm.RetrievalProvider.ListDeals()
for _, deal := range deals {
if deal.ChannelID != nil {
if deal.ChannelID.Initiator == "" || deal.ChannelID.Responder == "" {
deal.ChannelID = nil // don't try to push unparsable peer IDs over jsonrpc
}
}
out = append(out, deal)
}