Skip to content

Commit d0016ee

Browse files
authored
node: Enable miner rpc in authrpc if enabled in http (#491)
* Enable miner rpc in authrpc if enabled in http * Use slices.Contains fn
1 parent 0251cf7 commit d0016ee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

node/node.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ func (n *Node) startRPC() error {
430430
}
431431

432432
initAuth := func(port int, secret []byte) error {
433+
authModules := DefaultAuthModules
434+
if slices.Contains(n.config.HTTPModules, "miner") {
435+
authModules = append(authModules, "miner")
436+
}
437+
433438
// Enable auth via HTTP
434439
server := n.httpAuth
435440
if err := server.setListenAddr(n.config.AuthAddr, port); err != nil {
@@ -444,7 +449,7 @@ func (n *Node) startRPC() error {
444449
err := server.enableRPC(allAPIs, httpConfig{
445450
CorsAllowedOrigins: DefaultAuthCors,
446451
Vhosts: n.config.AuthVirtualHosts,
447-
Modules: DefaultAuthModules,
452+
Modules: authModules,
448453
prefix: DefaultAuthPrefix,
449454
rpcEndpointConfig: sharedConfig,
450455
})

0 commit comments

Comments
 (0)