mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
parent
175ef934ed
commit
4fb622bfd0
10 changed files with 7 additions and 30 deletions
|
|
@ -146,7 +146,6 @@ func (XDCx *XDCX) APIs() []rpc.API {
|
|||
Namespace: ProtocolName,
|
||||
Version: ProtocolVersionStr,
|
||||
Service: NewPublicXDCXAPI(XDCx),
|
||||
Public: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ func (l *Lending) APIs() []rpc.API {
|
|||
Namespace: ProtocolName,
|
||||
Version: ProtocolVersionStr,
|
||||
Service: NewPublicXDCXLendingAPI(l),
|
||||
Public: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
}...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue