Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
Unify relay list
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Apr 9, 2024
1 parent 99ae803 commit 96a0d49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
9 changes: 2 additions & 7 deletions mutiny-core/src/hermes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use crate::{
storage::MutinyStorage,
utils, PrivacyLevel,
};
use crate::nostr::RELAYS;

const HERMES_SERVICE_ID: u32 = 1;
#[allow(dead_code)]
Expand Down Expand Up @@ -94,14 +95,8 @@ impl<S: MutinyStorage> HermesClient<S> {
let public_key = keys.public_key();
let client = Client::new(&keys);

let relays: Vec<String> = vec![
"wss://relay.primal.net".to_string(),
"wss://relay.damus.io".to_string(),
"wss://nostr.mutinywallet.com".to_string(),
"wss://relay.mutinywallet.com".to_string(),
];
client
.add_relays(relays)
.add_relays(RELAYS)
.await
.expect("Failed to add relays");

Expand Down
17 changes: 9 additions & 8 deletions mutiny-core/src/nostr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ pub enum ReservedProfile {

pub(crate) const MUTINY_PLUS_SUBSCRIPTION_LABEL: &str = "Mutiny+ Subscription";

/// Default relays to use for nostr
pub(crate) const RELAYS: [&str; 4] = [
"wss://relay.primal.net",
"wss://relay.damus.io",
"wss://nostr.mutinywallet.com",
"wss://relay.mutinywallet.com",
];

impl ReservedProfile {
pub fn info(&self) -> (&'static str, u32) {
let (n, i) = match self {
Expand Down Expand Up @@ -265,16 +273,9 @@ impl<S: MutinyStorage> NostrManager<S> {
.iter()
.filter(|x| x.profile.active())
.map(|x| x.profile.relay.clone())
.chain(RELAYS.iter().map(|x| x.to_string()))
.collect();

// add relays to pull DMs from
relays.push("wss://relay.primal.net".to_string());
relays.push("wss://relay.damus.io".to_string());

// add relays for default sending
relays.push("wss://nostr.mutinywallet.com".to_string()); // blastr
relays.push("wss://relay.mutinywallet.com".to_string()); // strfry

// remove duplicates
relays.sort();
relays.dedup();
Expand Down

0 comments on commit 96a0d49

Please sign in to comment.