Skip to content

Commit

Permalink
- fix: empty node address or proxy node (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Jun 17, 2024
1 parent 7de8352 commit 610dd77
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion shinkai-bin/shinkai-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shinkai_node"
version = "0.7.12"
version = "0.7.13"
edition = "2021"
authors.workspace = true
# this causes `cargo run` in the workspace root to run this package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::net::{AddrParseError, SocketAddr};
use std::sync::Arc;
use std::time::SystemTime;
use std::time::{Duration, UNIX_EPOCH};
use std::vec;
use tokio::net::lookup_host;
use tokio::task;
use x25519_dalek::PublicKey;
Expand Down Expand Up @@ -112,11 +113,13 @@ impl OnchainIdentity {
)
.as_str(),
);

let default_value = "localhost:9550";
let first_address = self
.address_or_proxy_nodes
.iter().filter(|addr| !addr.is_empty())
.collect::<Vec<_>>()
.first()
.map_or("localhost:9550", |addr| addr.as_str());
.map_or(default_value, |addr| addr.as_str());
let address = Self::validate_address(first_address)?;

// Try to parse the address directly first
Expand Down

0 comments on commit 610dd77

Please sign in to comment.