Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got rid of the automatic usage of net api #3952

Merged
merged 6 commits into from
Apr 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions cmd/rpcdaemon/cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

if db != nil {
var cc *params.ChainConfig
if err := db.View(context.Background(), func(tx kv.Tx) error {
Expand All @@ -313,20 +314,17 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger,
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 {
hasEthApiEnabled := false
hasEngineApiEnabled := false
hasNetApiEnabled := false

for _, api := range cfg.API {
switch api {
case "eth":
hasEthApiEnabled = true
case "engine":
hasEngineApiEnabled = true
case "net":
hasNetApiEnabled = true
}
}

Expand All @@ -337,11 +335,6 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger,
if !hasEngineApiEnabled {
cfg.API = append(cfg.API, "engine")
}

if !hasNetApiEnabled {
cfg.API = append(cfg.API, "net")
}

}
}

Expand Down