Skip to content

Commit cec7dcb

Browse files
committed
node: report actual port used for http rpc (ethereum#20789)
1 parent ef8fa66 commit cec7dcb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

node/node.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
357357
if err != nil {
358358
return err
359359
}
360-
n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%s", endpoint), "cors", strings.Join(cors, ","), "vhosts", strings.Join(vhosts, ","))
360+
n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%v/", listener.Addr()),
361+
"cors", strings.Join(cors, ","),
362+
"vhosts", strings.Join(vhosts, ","))
361363
// All listeners booted successfully
362364
n.httpEndpoint = endpoint
363365
n.httpListener = listener
@@ -369,10 +371,10 @@ func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors
369371
// stopHTTP terminates the HTTP RPC endpoint.
370372
func (n *Node) stopHTTP() {
371373
if n.httpListener != nil {
374+
url := fmt.Sprintf("http://%v/", n.httpListener.Addr())
372375
n.httpListener.Close()
373376
n.httpListener = nil
374-
375-
n.log.Info("HTTP endpoint closed", "url", fmt.Sprintf("http://%s", n.httpEndpoint))
377+
n.log.Info("HTTP endpoint closed", "url", url)
376378
}
377379
if n.httpHandler != nil {
378380
n.httpHandler.Stop()

0 commit comments

Comments
 (0)