diff --git a/XDCx/XDCx.go b/XDCx/XDCx.go index 6fe39d4390..60a73455eb 100644 --- a/XDCx/XDCx.go +++ b/XDCx/XDCx.go @@ -146,7 +146,6 @@ func (XDCx *XDCX) APIs() []rpc.API { Namespace: ProtocolName, Version: ProtocolVersionStr, Service: NewPublicXDCXAPI(XDCx), - Public: true, }, } } diff --git a/XDCxlending/XDCxlending.go b/XDCxlending/XDCxlending.go index 7b6e4e5b65..80cc74415d 100644 --- a/XDCxlending/XDCxlending.go +++ b/XDCxlending/XDCxlending.go @@ -92,7 +92,6 @@ func (l *Lending) APIs() []rpc.API { Namespace: ProtocolName, Version: ProtocolVersionStr, Service: NewPublicXDCXLendingAPI(l), - Public: true, }, } } diff --git a/consensus/XDPoS/XDPoS.go b/consensus/XDPoS/XDPoS.go index 411411d518..04114bcd1c 100644 --- a/consensus/XDPoS/XDPoS.go +++ b/consensus/XDPoS/XDPoS.go @@ -176,7 +176,6 @@ func (x *XDPoS) APIs(chain consensus.ChainReader) []rpc.API { Namespace: "XDPoS", Version: "1.0", Service: &API{chain: chain, XDPoS: x}, - Public: true, }} } diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index da06f9e55f..f3a5773b51 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -695,6 +695,5 @@ func (c *Clique) APIs(chain consensus.ChainReader) []rpc.API { Namespace: "clique", Version: "1.0", Service: &API{chain: chain, clique: c}, - Public: false, }} } diff --git a/eth/backend.go b/eth/backend.go index ae0fd487ed..9556ea07dc 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -402,27 +402,22 @@ func (e *Ethereum) APIs() []rpc.API { Namespace: "eth", Version: "1.0", Service: NewPublicEthereumAPI(e), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: NewPublicMinerAPI(e), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: downloader.NewPublicDownloaderAPI(e.protocolManager.downloader, e.eventMux), - Public: true, }, { Namespace: "miner", Version: "1.0", Service: NewPrivateMinerAPI(e), - Public: false, }, { Namespace: "eth", Version: "1.0", Service: filters.NewFilterAPI(filters.NewFilterSystem(e.ApiBackend, filters.Config{LogCacheSize: e.config.FilterLogCacheSize}), false), - Public: true, }, { Namespace: "admin", Version: "1.0", @@ -431,7 +426,6 @@ func (e *Ethereum) APIs() []rpc.API { Namespace: "debug", Version: "1.0", Service: NewPublicDebugAPI(e), - Public: true, }, { Namespace: "debug", Version: "1.0", @@ -440,7 +434,6 @@ func (e *Ethereum) APIs() []rpc.API { Namespace: "net", Version: "1.0", Service: e.netRPCService, - Public: true, }, }...) } diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index e4cdf283da..53bff4ab19 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -126,32 +126,26 @@ func GetAPIs(apiBackend Backend, chainReader consensus.ChainReader) []rpc.API { Namespace: "eth", Version: "1.0", Service: NewPublicEthereumAPI(apiBackend), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: NewPublicBlockChainAPI(apiBackend, chainReader), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: NewPublicTransactionPoolAPI(apiBackend, nonceLock), - Public: true, }, { Namespace: "XDCx", Version: "1.0", Service: NewPublicXDCXTransactionPoolAPI(apiBackend, nonceLock), - Public: true, }, { Namespace: "txpool", Version: "1.0", Service: NewPublicTxPoolAPI(apiBackend), - Public: true, }, { Namespace: "debug", Version: "1.0", Service: NewPublicDebugAPI(apiBackend), - Public: true, }, { Namespace: "debug", Version: "1.0", @@ -160,12 +154,10 @@ func GetAPIs(apiBackend Backend, chainReader consensus.ChainReader) []rpc.API { Namespace: "eth", Version: "1.0", Service: NewPublicAccountAPI(apiBackend.AccountManager()), - Public: true, }, { Namespace: "personal", Version: "1.0", Service: NewPrivateAccountAPI(apiBackend, nonceLock), - Public: false, }, } } diff --git a/node/api.go b/node/api.go index cfe904f06c..67fd03346a 100644 --- a/node/api.go +++ b/node/api.go @@ -40,7 +40,6 @@ func (n *Node) apis() []rpc.API { Namespace: "admin", Version: "1.0", Service: &publicAdminAPI{n}, - Public: true, }, { Namespace: "debug", Version: "1.0", @@ -49,7 +48,6 @@ func (n *Node) apis() []rpc.API { Namespace: "web3", Version: "1.0", Service: &publicWeb3API{n}, - Public: true, }, } diff --git a/node/rpcstack.go b/node/rpcstack.go index 2a510ffb9e..fd9d00a6ea 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -276,7 +276,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error { // Create RPC server and handler. srv := rpc.NewServer() - if err := RegisterApisFromWhitelist(apis, config.Modules, srv, false); err != nil { + if err := RegisterApisFromWhitelist(apis, config.Modules, srv); err != nil { return err } h.httpConfig = config @@ -308,7 +308,7 @@ func (h *httpServer) enableWS(apis []rpc.API, config wsConfig) error { // Create RPC server and handler. srv := rpc.NewServer() - if err := RegisterApisFromWhitelist(apis, config.Modules, srv, false); err != nil { + if err := RegisterApisFromWhitelist(apis, config.Modules, srv); err != nil { return err } h.wsConfig = config @@ -521,7 +521,7 @@ func (is *ipcServer) stop() error { // RegisterApisFromWhitelist checks the given modules' availability, generates a whitelist based on the allowed modules, // and then registers all of the APIs exposed by the services. -func RegisterApisFromWhitelist(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error { +func RegisterApisFromWhitelist(apis []rpc.API, modules []string, srv *rpc.Server) error { if bad, available := checkModuleAvailability(modules, apis); len(bad) > 0 { log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available) } @@ -532,7 +532,7 @@ func RegisterApisFromWhitelist(apis []rpc.API, modules []string, srv *rpc.Server } // Register all the APIs exposed by the services for _, api := range apis { - if exposeAll || whitelist[api.Namespace] || (len(whitelist) == 0 && api.Public) { + if whitelist[api.Namespace] || len(whitelist) == 0 { if err := srv.RegisterName(api.Namespace, api.Service); err != nil { return err } diff --git a/node/utils_test.go b/node/utils_test.go index 227c05a199..e7b8630eb6 100644 --- a/node/utils_test.go +++ b/node/utils_test.go @@ -82,11 +82,11 @@ func (f *FullService) Stop() error { return nil } func (f *FullService) Protocols() []p2p.Protocol { return []p2p.Protocol{ - p2p.Protocol{ + { Name: "test1", Version: uint(1), }, - p2p.Protocol{ + { Name: "test2", Version: uint(2), }, @@ -102,12 +102,10 @@ func (f *FullService) APIs() []rpc.API { { Namespace: "debug", Version: "1.0", - Public: true, }, { Namespace: "net", Version: "1.0", - Public: true, }, } } diff --git a/rpc/types.go b/rpc/types.go index 9e37e33c74..62f173ae88 100644 --- a/rpc/types.go +++ b/rpc/types.go @@ -32,7 +32,7 @@ type API struct { Namespace string // namespace under which the rpc methods of Service are exposed Version string // api version for DApp's Service interface{} // receiver instance which holds the methods - Public bool // indication if the methods must be considered safe for public use + Public bool // deprecated - this field is no longer used, but retained for compatibility } // ServerCodec implements reading, parsing and writing RPC messages for the server side of