Skip to content

Commit 2d0afc6

Browse files
committed
go/worker/compute/executor: Fix detection of last epoch block
1 parent 00cdaf3 commit 2d0afc6

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • go/worker/compute/executor/committee

go/worker/compute/executor/committee/node.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,21 @@ func (n *Node) scheduleBatch(ctx context.Context, round uint64, force bool) {
344344

345345
// If the next block will be an epoch transition block, do not propose anything as it will be
346346
// reverted anyway (since the committee will change).
347-
epochState, err := n.commonNode.Consensus.Beacon().GetFutureEpoch(ctx, n.dispatchInfo.BlockInfo.ConsensusBlock.Height)
347+
height, err := n.commonNode.Consensus.Core().GetLatestHeight(ctx)
348+
if err != nil {
349+
n.logger.Error("failed to fetch latest height",
350+
"err", err,
351+
)
352+
return
353+
}
354+
epochState, err := n.commonNode.Consensus.Beacon().GetFutureEpoch(ctx, height)
348355
if err != nil {
349356
n.logger.Error("failed to fetch future epoch state",
350357
"err", err,
351358
)
352359
return
353360
}
354-
if epochState != nil && epochState.Height == n.dispatchInfo.BlockInfo.ConsensusBlock.Height+1 {
361+
if epochState != nil && epochState.Height == height+1 {
355362
n.logger.Debug("not scheduling, next consensus block is an epoch transition")
356363
return
357364
}

0 commit comments

Comments
 (0)