From ad4fef4f09bc769a9e60d06058b7ef649b05b736 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Fri, 21 Sep 2018 10:19:08 -0600 Subject: [PATCH] Doc for rpc_port configuration --- src/fullnode.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/fullnode.rs b/src/fullnode.rs index dc5c9f3844..50245ec756 100644 --- a/src/fullnode.rs +++ b/src/fullnode.rs @@ -248,11 +248,12 @@ impl Fullnode { // TODO: this code assumes this node is the leader let mut drone_addr = node.info.contact_info.tpu; drone_addr.set_port(DRONE_PORT); - let rpc_addr = if let Some(port) = rpc_port { - SocketAddr::new(IpAddr::V4(Ipv4Addr::from(0)), port) - } else { - SocketAddr::new(IpAddr::V4(Ipv4Addr::from(0)), RPC_PORT) - }; + + // Use custom RPC port, if provided (`Some(port)`) + // RPC port may be any open port on the node + // If rpc_port == `None`, node will listen on the default RPC_PORT from Rpc module + // If rpc_port == `Some(0)`, node will dynamically choose any open port. Useful for tests. + let rpc_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::from(0)), rpc_port.unwrap_or(RPC_PORT)); let rpc_service = JsonRpcService::new( &bank, node.info.contact_info.tpu,