Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jhgdike committed Aug 27, 2024
1 parent b095cd1 commit 683deee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 7 additions & 1 deletion beacon/fakebeacon/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"net/http"
"strconv"

"github.com/ethereum/go-ethereum/log"

"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/gorilla/mux"
"github.com/prysmaticlabs/prysm/v5/api/server"
Expand Down Expand Up @@ -53,7 +55,11 @@ func NewService(cfg *Config, backend ethapi.Backend) *Service {
}

func (s *Service) Run() {
_ = http.ListenAndServe(s.cfg.Addr+strconv.Itoa(s.cfg.Port), s.router)
log.Info("FakeBeacon server listening on", "addr", s.cfg.Addr, "port", s.cfg.Port)
err := http.ListenAndServe(s.cfg.Addr+strconv.Itoa(s.cfg.Port), s.router)
if err != nil {
log.Error("Failed to start FakeBeacon server", "err", err)
}
}

func (s *Service) newRouter() *mux.Router {
Expand Down
6 changes: 2 additions & 4 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,14 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
utils.RegisterEthStatsService(stack, backend, cfg.Ethstats.URL)
}

if ctx.IsSet(utils.FakeBeaconEnabledFlag.Name) {
cfg.FakeBeacon.Enable = ctx.Bool(utils.FakeBeaconEnabledFlag.Name)
}
if ctx.IsSet(utils.FakeBeaconAddrFlag.Name) {
cfg.FakeBeacon.Addr = ctx.String(utils.FakeBeaconAddrFlag.Name)
}
if ctx.IsSet(utils.FakeBeaconPortFlag.Name) {
cfg.FakeBeacon.Port = ctx.Int(utils.FakeBeaconPortFlag.Name)
}
if cfg.FakeBeacon.Enable {
log.Info("FakeBeacon config", "enable", cfg.FakeBeacon.Enable, "port", cfg.FakeBeacon.Port)
if cfg.FakeBeacon.Enable || ctx.IsSet(utils.FakeBeaconEnabledFlag.Name) {
go fakebeacon.NewService(&cfg.FakeBeacon, backend).Run()
}

Expand Down

0 comments on commit 683deee

Please sign in to comment.