Merge pull request #5759 from filecoin-project/asr/terminate-livecheck

Check liveness of sectors when processing termination batches
This commit is contained in:
Łukasz Magiera 2021-03-10 11:14:11 +01:00 committed by GitHub
commit df0a8d9507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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