Skip to content

Commit

Permalink
feat(beaconclient): don't wait for v2 publish
Browse files Browse the repository at this point in the history
  • Loading branch information
alextes committed Nov 29, 2023
1 parent 689b1c9 commit f3309b9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions beaconclient/prod_beacon_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,18 @@ func (c *ProdBeaconInstance) PublishBlock(block *common.SignedBeaconBlock, broad

// v2
if c.ffUseV2PublishBlockEndpoint {
uriV2 := fmt.Sprintf("%s/eth/v2/beacon/blocks?broadcast_validation=%s", c.beaconURIV2, broadcastMode.String())
headers = http.Header{}
// optional in v1, required in v2
headers.Add("Eth-Consensus-Version", common.ForkVersionStringCapella)
v2Result, v2Err := fetchBeacon(http.MethodPost, uriV2, block, nil, nil, headers)
if v2Err != nil {
c.log.WithError(v2Err).Error("failed to publish block to v2 endpoint")
} else {
c.log.WithField("code", v2Result).Info("published block to v2 endpoint")
}
go func() {
uriV2 := fmt.Sprintf("%s/eth/v2/beacon/blocks?broadcast_validation=%s", c.beaconURIV2, broadcastMode.String())
headers = http.Header{}
// optional in v1, required in v2
headers.Add("Eth-Consensus-Version", common.ForkVersionStringCapella)
v2Result, v2Err := fetchBeacon(http.MethodPost, uriV2, block, nil, nil, headers)
if v2Err != nil {
c.log.WithError(v2Err).Error("failed to publish block to v2 endpoint")
} else {
c.log.WithField("code", v2Result).Info("published block to v2 endpoint")
}
}()
}

return v1Result, err
Expand Down

0 comments on commit f3309b9

Please sign in to comment.