mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-30 15:06:31 +00:00
210edfc940
* proto: illegal wireType 7 :( * set addr to todo for now so somethign gets sent * push latest progress * Add feedback from @raulk. Stream never connects * working handshake handler * add exclusions for relay/bootstrap node * fix tests, still need to add new ones * remove race, fails coverage * Add test for negotiation * gazelle * regen pb * Update shared/p2p/handshake_handler.go Co-Authored-By: prestonvanloon <preston@prysmaticlabs.com>
42 lines
848 B
Go
42 lines
848 B
Go
package node
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"net/http"
|
|
"sync"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
)
|
|
|
|
var cachedDepositAddress string
|
|
var fetchLock sync.Mutex
|
|
|
|
// fetchDepositContract from the cluster endpoint.
|
|
func fetchDepositContract() (string, error) {
|
|
fetchLock.Lock()
|
|
defer fetchLock.Unlock()
|
|
|
|
if cachedDepositAddress != "" {
|
|
return cachedDepositAddress, nil
|
|
}
|
|
|
|
log.WithField(
|
|
"endpoint",
|
|
params.BeaconConfig().TestnetContractEndpoint,
|
|
).Info("Fetching testnet cluster address")
|
|
resp, err := http.Get(params.BeaconConfig().TestnetContractEndpoint)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
contractResponse, err := ioutil.ReadAll(resp.Body)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
if err := resp.Body.Close(); err != nil {
|
|
return "", err
|
|
}
|
|
|
|
cachedDepositAddress = string(contractResponse)
|
|
return cachedDepositAddress, nil
|
|
}
|