Review Response
This commit is contained in:
parent
3a6aae3e10
commit
d86a68f713
@ -227,21 +227,31 @@ func (m *Sealing) handleWaitMutable(ctx statemachine.Context, sector SectorInfo)
|
|||||||
// Sleep for immutable epochs
|
// Sleep for immutable epochs
|
||||||
if immutable {
|
if immutable {
|
||||||
dlineEpochsRemaining := dlinfo.NextOpen() - ts.Height()
|
dlineEpochsRemaining := dlinfo.NextOpen() - ts.Height()
|
||||||
waitTime := time.Duration(0)
|
var targetEpoch abi.ChainEpoch
|
||||||
if sectorDeadlineOpen {
|
if sectorDeadlineOpen {
|
||||||
// sleep for remainder of deadline
|
// sleep for remainder of deadline
|
||||||
waitTime = time.Duration(build.BlockDelaySecs) * time.Second * time.Duration(dlineEpochsRemaining)
|
targetEpoch = ts.Height() + dlineEpochsRemaining
|
||||||
} else {
|
} else {
|
||||||
// sleep for remainder of deadline and next one
|
// sleep for remainder of deadline and next one
|
||||||
waitTime = time.Duration(build.BlockDelaySecs) * time.Second * time.Duration(dlineEpochsRemaining+dlinfo.WPoStChallengeWindow)
|
targetEpoch = ts.Height() + dlineEpochsRemaining + dlinfo.WPoStChallengeWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atHeight := make(chan struct{})
|
||||||
|
m.events.ChainAt(ctx.Context(), func(context.Context, *types.TipSet, abi.ChainEpoch) error {
|
||||||
|
close(atHeight)
|
||||||
|
return nil
|
||||||
|
}, func(ctx context.Context, ts *types.TipSet) error {
|
||||||
|
log.Warn("revert in handleWaitMutable")
|
||||||
|
return nil
|
||||||
|
}, 5, targetEpoch)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(waitTime):
|
case <-atHeight:
|
||||||
case <-ctx.Context().Done():
|
case <-ctx.Context().Done():
|
||||||
return ctx.Context().Err()
|
return ctx.Context().Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return ctx.Send(SectorDeadlineMutable{})
|
return ctx.Send(SectorDeadlineMutable{})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user