From 077bc83f7f7bc454ce27b0f44e0de6351d1331c1 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 30 Oct 2020 14:00:41 -0700 Subject: [PATCH] explicitly abort PoSt on context cancellation --- storage/wdpost_run.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/storage/wdpost_run.go b/storage/wdpost_run.go index e7bd74162..f1da4f221 100644 --- a/storage/wdpost_run.go +++ b/storage/wdpost_run.go @@ -612,6 +612,15 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty log.Warnw("generate window post skipped sectors", "sectors", ps, "error", err, "try", retries) + // Explicitly make sure we haven't aborted this PoSt + // (GenerateWindowPoSt may or may not check this). + // Otherwise, we could try to continue proving a + // deadline after the deadline has ended. + if ctx.Err() != nil { + log.Warnw("aborting PoSt due to context cancellation", "error", ctx.Err(), "deadline", di.Index) + return nil, ctx.Err() + } + skipCount += uint64(len(ps)) for _, sector := range ps { postSkipped.Set(uint64(sector.Number))