Skip to content

Commit

Permalink
fix: limit max relays count to 4
Browse files Browse the repository at this point in the history
  • Loading branch information
sameh-farouk committed Oct 2, 2023
1 parent a1c8191 commit 3424dca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/bins/rmb-peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct Params {
)]
substrate: Vec<String>,

/// set of relay Urls (max 3) please ensure url contain a domain
/// set of relay Urls (max 4) please ensure url contain a domain
#[clap(long, action=ArgAction::Append, default_values = ["wss://relay.grid.tf:443"])]
relay: Vec<String>,

Expand Down Expand Up @@ -167,6 +167,10 @@ async fn app(args: Params) -> Result<()> {
let relays_urls: Vec<url::Url> =
parse_urls(&args.relay).context("failed to parse relays urls")?;

if relays_urls.len() > 4 {
anyhow::bail!("the number of relays should not exceed 4");
}

if !args.no_update {
// try to check and update the twin info on chain

Expand Down

0 comments on commit 3424dca

Please sign in to comment.