@@ -3,6 +3,7 @@ package builder
33import (
44 "errors"
55 _ "os"
6+ "time"
67
78 "github.com/ethereum/go-ethereum/common/hexutil"
89 "github.com/ethereum/go-ethereum/core/beacon"
@@ -41,6 +42,7 @@ type Builder struct {
4142 beaconClient IBeaconClient
4243 relay IRelay
4344 eth IEthereumService
45+ resubmitter Resubmitter
4446
4547 builderSecretKey * bls.SecretKey
4648 builderPublicKey boostTypes.PublicKey
@@ -56,6 +58,7 @@ func NewBuilder(sk *bls.SecretKey, bc IBeaconClient, relay IRelay, builderSignin
5658 beaconClient : bc ,
5759 relay : relay ,
5860 eth : eth ,
61+ resubmitter : Resubmitter {},
5962 builderSecretKey : sk ,
6063 builderPublicKey : pk ,
6164
@@ -140,13 +143,23 @@ func (b *Builder) OnPayloadAttribute(attrs *BuilderPayloadAttributes) error {
140143 return errors .New ("parent block not found in blocktree" )
141144 }
142145
143- executableData , block := b .eth .BuildBlock (attrs )
144- if executableData == nil || block == nil {
145- log .Error ("did not receive the payload" )
146- return errors .New ("could not build block" )
147- }
146+ firstBlockResult := b .resubmitter .newTask (12 * time .Second , time .Second , func () error {
147+ executableData , block := b .eth .BuildBlock (attrs )
148+ if executableData == nil || block == nil {
149+ log .Error ("did not receive the payload" )
150+ return errors .New ("did not receive the payload" )
151+ }
152+
153+ err := b .onSealedBlock (executableData , block , proposerPubkey , vd .FeeRecipient , attrs .Slot )
154+ if err != nil {
155+ log .Error ("could not run block hook" , "err" , err )
156+ return err
157+ }
158+
159+ return nil
160+ })
148161
149- return b . onSealedBlock ( executableData , block , proposerPubkey , vd . FeeRecipient , attrs . Slot )
162+ return firstBlockResult
150163}
151164
152165func executableDataToExecutionPayload (data * beacon.ExecutableDataV1 ) (* boostTypes.ExecutionPayload , error ) {
0 commit comments