got rid of the automatic usage of net api (#3952)

* got rid of the automatic usage of net api

* less confusing comment

* ops

* ops2

* important

* ops
This commit is contained in:
Enrique Jose Avila Asapche 2022-04-25 15:57:54 +03:00 committed by GitHub
parent 230a21cfff
commit e2fec2a081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -288,6 +288,7 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger,
} }
log.Info("if you run RPCDaemon on same machine with Erigon add --datadir option") log.Info("if you run RPCDaemon on same machine with Erigon add --datadir option")
} }
if db != nil { if db != nil {
var cc *params.ChainConfig var cc *params.ChainConfig
if err := db.View(context.Background(), func(tx kv.Tx) error { if err := db.View(context.Background(), func(tx kv.Tx) error {
@ -313,11 +314,10 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger,
cfg.Snapshot = ethconfig.NewSnapshotCfg(cfg.Snapshot.Enabled, cfg.Snapshot.KeepBlocks) cfg.Snapshot = ethconfig.NewSnapshotCfg(cfg.Snapshot.Enabled, cfg.Snapshot.KeepBlocks)
} }
// if chain config has terminal total difficulty then rpc has to have these API's to function // if chain config has terminal total difficulty then rpc must have eth and engine APIs enableds
if cc.TerminalTotalDifficulty != nil { if cc.TerminalTotalDifficulty != nil {
hasEthApiEnabled := false hasEthApiEnabled := false
hasEngineApiEnabled := false hasEngineApiEnabled := false
hasNetApiEnabled := false
for _, api := range cfg.API { for _, api := range cfg.API {
switch api { switch api {
@ -325,8 +325,6 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger,
hasEthApiEnabled = true hasEthApiEnabled = true
case "engine": case "engine":
hasEngineApiEnabled = true hasEngineApiEnabled = true
case "net":
hasNetApiEnabled = true
} }
} }
@ -337,11 +335,6 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger,
if !hasEngineApiEnabled { if !hasEngineApiEnabled {
cfg.API = append(cfg.API, "engine") cfg.API = append(cfg.API, "engine")
} }
if !hasNetApiEnabled {
cfg.API = append(cfg.API, "net")
}
} }
} }