Skip to content

Commit

Permalink
Changing primary_address to use tcp and adding ip4/ip6/dns support fo…
Browse files Browse the repository at this point in the history
…r transport string
  • Loading branch information
gokhan-simsek-iota committed Dec 18, 2024
1 parent 0ae9833 commit 7d2b530
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions crates/iota/src/validator_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
collections::{BTreeMap, HashSet},
fmt::{self, Debug, Display, Formatter, Write},
fs,
net::{Ipv4Addr, Ipv6Addr},
path::PathBuf,
};

Expand Down Expand Up @@ -330,6 +331,13 @@ impl IotaValidatorCommand {
&authority_keypair,
(&account_keypair.public()).into(),
);
let transport_str = if host_name.parse::<Ipv4Addr>().is_ok() {
"ip4"
} else if host_name.parse::<Ipv6Addr>().is_ok() {
"ip6"
} else {
"dns"
};
let validator_info = GenesisValidatorInfo {
info: iota_genesis_builder::validator_info::ValidatorInfo {
name,
Expand All @@ -340,13 +348,16 @@ impl IotaValidatorCommand {
gas_price,
commission_rate: iota_config::node::DEFAULT_COMMISSION_RATE,
network_address: Multiaddr::try_from(format!(
"/dns/{}/tcp/8080/http",
host_name
"/{}/{}/tcp/8080/http",
transport_str, host_name
))?,
p2p_address: Multiaddr::try_from(format!(
"/{}/{}/udp/8084",
transport_str, host_name
))?,
p2p_address: Multiaddr::try_from(format!("/dns/{}/udp/8084", host_name))?,
primary_address: Multiaddr::try_from(format!(
"/dns/{}/udp/8081",
host_name
"/{}/{}/tcp/8081",
transport_str, host_name
))?,
description,
image_url,
Expand Down

0 comments on commit 7d2b530

Please sign in to comment.