|
|
@ -10,6 +10,7 @@ import ( |
|
|
|
"github.com/ethereum/go-ethereum/rpc" |
|
|
|
"github.com/ethereum/go-ethereum/rpc" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/harmony-one/harmony/hmy" |
|
|
|
"github.com/harmony-one/harmony/hmy" |
|
|
|
|
|
|
|
nodeconfig "github.com/harmony-one/harmony/internal/configs/node" |
|
|
|
"github.com/harmony-one/harmony/internal/hmyapi" |
|
|
|
"github.com/harmony-one/harmony/internal/hmyapi" |
|
|
|
"github.com/harmony-one/harmony/internal/hmyapi/filters" |
|
|
|
"github.com/harmony-one/harmony/internal/hmyapi/filters" |
|
|
|
"github.com/harmony-one/harmony/internal/utils" |
|
|
|
"github.com/harmony-one/harmony/internal/utils" |
|
|
@ -56,12 +57,17 @@ func (node *Node) StartRPC(nodePort string) error { |
|
|
|
|
|
|
|
|
|
|
|
port, _ := strconv.Atoi(nodePort) |
|
|
|
port, _ := strconv.Atoi(nodePort) |
|
|
|
|
|
|
|
|
|
|
|
httpEndpoint = fmt.Sprintf(":%v", port+rpcHTTPPortOffset) |
|
|
|
ip := "" |
|
|
|
|
|
|
|
if !nodeconfig.GetPublicRPC() { |
|
|
|
|
|
|
|
ip = "127.0.0.1" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
httpEndpoint = fmt.Sprintf("%v:%v", ip, port+rpcHTTPPortOffset) |
|
|
|
|
|
|
|
|
|
|
|
if err := node.startHTTP(httpEndpoint, apis, httpModules, httpOrigins, httpVirtualHosts, httpTimeouts); err != nil { |
|
|
|
if err := node.startHTTP(httpEndpoint, apis, httpModules, httpOrigins, httpVirtualHosts, httpTimeouts); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wsEndpoint = fmt.Sprintf(":%v", port+rpcWSPortOffset) |
|
|
|
wsEndpoint = fmt.Sprintf("%v:%v", ip, port+rpcWSPortOffset) |
|
|
|
if err := node.startWS(wsEndpoint, apis, wsModules, wsOrigins, true); err != nil { |
|
|
|
if err := node.startWS(wsEndpoint, apis, wsModules, wsOrigins, true); err != nil { |
|
|
|
node.stopHTTP() |
|
|
|
node.stopHTTP() |
|
|
|
return err |
|
|
|
return err |
|
|
|