From 57e5f5ec589d681cbfbc7d40c8c96cc9a52b768d Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 8 Nov 2024 17:24:31 +0800 Subject: [PATCH] rpc: not log error if user configures --rpcapi=rpc (#20776) --- rpc/endpoints.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rpc/endpoints.go b/rpc/endpoints.go index 9cb6cc7770..eb14e99f6f 100644 --- a/rpc/endpoints.go +++ b/rpc/endpoints.go @@ -23,8 +23,9 @@ import ( "github.com/XinFinOrg/XDPoSChain/log" ) -// checkModuleAvailability check that all names given in modules are actually -// available API services. +// checkModuleAvailability checks that all names given in modules are actually +// available API services. It assumes that the MetadataApi module ("rpc") is always available; +// the registration of this "rpc" module happens in NewServer() and is thus common to all endpoints. func checkModuleAvailability(modules []string, apis []API) (bad, available []string) { availableSet := make(map[string]struct{}) for _, api := range apis { @@ -34,7 +35,7 @@ func checkModuleAvailability(modules []string, apis []API) (bad, available []str } } for _, name := range modules { - if _, ok := availableSet[name]; !ok { + if _, ok := availableSet[name]; !ok && name != MetadataApi { bad = append(bad, name) } }