Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix USE_V1_PUBLISH_BLOCK_ENDPOINT flag #582

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions beaconclient/prod_beacon_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"os"
"strings"
"time"

"github.com/attestantio/go-eth2-client/spec/capella"
Expand Down Expand Up @@ -244,12 +245,12 @@ func (c *ProdBeaconInstance) GetURI() string {
func (c *ProdBeaconInstance) PublishBlock(block *common.VersionedSignedProposal, broadcastMode BroadcastMode) (code int, err error) {
var uri string
if c.ffUseV1PublishBlockEndpoint {
uri = fmt.Sprintf("%s/eth/v2/beacon/blocks?broadcast_validation=%s", c.beaconURI, broadcastMode)
} else {
uri = fmt.Sprintf("%s/eth/v1/beacon/blocks", c.beaconURI)
} else {
uri = fmt.Sprintf("%s/eth/v2/beacon/blocks?broadcast_validation=%s", c.beaconURI, broadcastMode)
}
headers := http.Header{}
headers.Add("Eth-Consensus-Version", common.ForkVersionStringCapella) // optional in v1, required in v2
headers.Add("Eth-Consensus-Version", strings.ToLower(block.Version.String())) // optional in v1, required in v2
return fetchBeacon(http.MethodPost, uri, block, nil, nil, headers, false)
}

Expand Down
Loading