Skip to content

Commit

Permalink
app,cmd: slightly modify ProduceELPayload
Browse files Browse the repository at this point in the history
  • Loading branch information
Raneet10 committed Feb 27, 2025
1 parent bdbb55a commit 6a3ddcb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
50 changes: 26 additions & 24 deletions app/abci_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,34 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
)

func (app *HeimdallApp) ProduceELPayload(ctx context.Context) error {
func (app *HeimdallApp) ProduceELPayload(ctx context.Context) {
logger := app.Logger()
var blockCtx nextELBlockCtx
select {
case blockCtx = <-app.nextBlockChan:
res, err := app.retryBuildNextPayload(blockCtx.context, blockCtx.height+1)
if err != nil {
return err
}

app.nextExecPayload = res
return nil

case blockCtx = <-app.currBlockChan:
res, err := app.retryBuildLatestPayload(blockCtx.context, blockCtx.height)
if err != nil {
return err
for {
select {
case blockCtx = <-app.nextBlockChan:
res, err := app.retryBuildNextPayload(blockCtx.context, blockCtx.height+1)
if err != nil {
logger.Error("error building next payload", "error", err)
res = nil
}

app.nextExecPayload = res

case blockCtx = <-app.currBlockChan:
res, err := app.retryBuildLatestPayload(blockCtx.context, blockCtx.height)
if err != nil {
logger.Error("error building latest payload", "error", err)
res = nil
}

app.latestExecPayload = res

case <-ctx.Done():
return

default:
}

app.latestExecPayload = res
return nil

case <-ctx.Done():
return nil

default:
return nil
}
}

Expand Down
7 changes: 1 addition & 6 deletions cmd/heimdalld/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package heimdalld

import (
"context"
"os"
"path"

Expand Down Expand Up @@ -142,11 +141,7 @@ func NewRootCmd() *cobra.Command {
}

go func() {
for {
if err := tempApp.ProduceELPayload(context.Background()); err != nil {
logger.Error("failed to produce EL block", "err", err)
}
}
tempApp.ProduceELPayload(rootCmd.Context())
}()
return rootCmd
}

0 comments on commit 6a3ddcb

Please sign in to comment.