Skip to content

Commit

Permalink
Merge pull request #612 from near/xiangyi/fix_new_node_join
Browse files Browse the repository at this point in the history
fix: add port to my_address so join method works
  • Loading branch information
volovyks authored May 27, 2024
2 parents 653f4e1 + 256954a commit 2d8d274
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,15 @@ pub fn run(cmd: Cli) -> anyhow::Result<()> {
));

let sign_sk = sign_sk.unwrap_or_else(|| account_sk.clone());
let my_address = my_address.unwrap_or_else(|| {
let my_ip = local_ip().unwrap();
Url::parse(&format!("http://{my_ip}:{web_port}")).unwrap()
});
let my_address = my_address
.map(|mut addr| {
addr.set_port(Some(web_port)).unwrap();
addr
})
.unwrap_or_else(|| {
let my_ip = local_ip().unwrap();
Url::parse(&format!("http://{my_ip}:{web_port}")).unwrap()
});
tracing::info!(%my_address, "address detected");
let rpc_client = near_fetch::Client::new(&near_rpc);
tracing::debug!(rpc_addr = rpc_client.rpc_addr(), "rpc client initialized");
Expand Down

0 comments on commit 2d8d274

Please sign in to comment.