diff --git a/extern/storage-sealing/terminate_batch.go b/extern/storage-sealing/terminate_batch.go index 31ccef93c..0e96e8384 100644 --- a/extern/storage-sealing/terminate_batch.go +++ b/extern/storage-sealing/terminate_batch.go @@ -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