Skip to content

Commit

Permalink
Merge pull request #248 from ethstorage/beacon-url
Browse files Browse the repository at this point in the history
Using url.JoinPath to generate beacon URL, and it will avoid invalid URL by having double "/"
  • Loading branch information
qzhodl authored Mar 16, 2024
2 parents bebcf7f + 22938ea commit 5f38159
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ethstorage/eth/beacon_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/url"

"github.com/crate-crypto/go-proto-danksharding-crypto/eth"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -58,8 +59,11 @@ func (c *BeaconClient) DownloadBlobs(slot uint64) (map[common.Hash]Blob, error)
// TODO: @Qiang There will be a change to the URL schema and a new indices query parameter
// We should do the corresponding change when it takes effect, maybe 4844-devnet-6?
// The details here: https://github.com/sigp/lighthouse/issues/4317
url := fmt.Sprintf("%s/eth/v1/beacon/blob_sidecars/%d", c.beaconURL, slot)
resp, err := http.Get(url)
beaconUrl, err := url.JoinPath(c.beaconURL, fmt.Sprintf("eth/v1/beacon/blob_sidecars/%d", slot))
if err != nil {
return nil, err
}
resp, err := http.Get(beaconUrl)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 5f38159

Please sign in to comment.