From 683deeef7af776d86a924e8cb683c19827f7238a Mon Sep 17 00:00:00 2001 From: dike Date: Tue, 27 Aug 2024 15:56:53 +0800 Subject: [PATCH] update --- beacon/fakebeacon/server.go | 8 +++++++- cmd/geth/config.go | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/beacon/fakebeacon/server.go b/beacon/fakebeacon/server.go index f81b9ebffa..f7bef583d3 100644 --- a/beacon/fakebeacon/server.go +++ b/beacon/fakebeacon/server.go @@ -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" @@ -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 { diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 1d52092695..6bdf0127ad 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -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() }