Check liveness of sectors when processing termination batches

This commit is contained in:
Aayush Rajasekaran 2021-03-09 23:36:30 -05:00
parent 9f721bfde5
commit 47064f987c

View File

@ -143,6 +143,18 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
continue
}
ps, err := b.api.StateMinerPartitions(b.mctx, b.maddr, loc.Deadline, nil)
if err != nil {
log.Warnw("TerminateBatcher: getting miner partitions", "deadline", loc.Deadline, "partition", loc.Partition, "error", err)
continue
}
toTerminate, err = bitfield.IntersectBitField(ps[loc.Partition].LiveSectors, toTerminate)
if err != nil {
log.Warnw("TerminateBatcher: intersecting liveSectors and toTerminate bitfields", "deadline", loc.Deadline, "partition", loc.Partition, "error", err)
continue
}
if total+n > uint64(miner.AddressedSectorsMax) {
n = uint64(miner.AddressedSectorsMax) - total