Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add port to my_address so join method works #612

Merged
merged 2 commits into from
May 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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| {
let _ = addr.set_port(Some(web_port));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should unwrap and fail early just in case the addr was inputted incorrectly

Suggested change
let _ = addr.set_port(Some(web_port));
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
Loading