Add filtering of addresses associated with miners

This commit is contained in:
Peter Rabbitson 2020-09-26 21:43:49 +02:00
parent 10cdbadd82
commit 1483f1e59a

View File

@ -201,6 +201,26 @@ func (dss *dealStatsServer) filteredDealList() (int64, map[string]dealInfo) {
return 0, nil return 0, nil
} }
// Exclude any address associated with a miner
miners, err := dss.api.StateListMiners(ctx, head.Key())
if err != nil {
log.Warnf("failed to get miner list: %s", err)
return 0, nil
}
for _, m := range miners {
info, err := dss.api.StateMinerInfo(ctx, m, head.Key())
if err != nil {
log.Warnf("failed to get info for known miner '%s': %s", m, err)
continue
}
knownFiltered.Store(info.Owner, true)
knownFiltered.Store(info.Worker, true)
for _, a := range info.ControlAddresses {
knownFiltered.Store(a, true)
}
}
deals, err := dss.api.StateMarketDeals(ctx, head.Key()) deals, err := dss.api.StateMarketDeals(ctx, head.Key())
if err != nil { if err != nil {
log.Warnf("failed to get market deals: %s", err) log.Warnf("failed to get market deals: %s", err)