From 7c100cf5d28cd5d1298de810f9c24832e881f69c Mon Sep 17 00:00:00 2001 From: daywalker90 Date: Sun, 9 Aug 2026 20:07:11 +0200 Subject: [PATCH] add default relays --- CHANGELOG.md | 1 + README.md | 7 ++++++- src/nwc.rs | 6 ++++++ src/parse.rs | 25 +++++++++++++------------ 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8097c3..e77df0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - holdinvoice notification: ``hold_invoice_accepted`` ### Changed +- there are now five default relays that will be used if ``nip47-relays`` is not set - `pay_keysend` will use the new CLN `xkeysend` command using CLN v26.06+ - Budget is updated on demand instead of by a background task - `list_transactions` is bounded (at most 500 transactions and ~128kB response) to prevent DoS diff --git a/README.md b/README.md index 1f1eb7f..5556fd0 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,12 @@ It is highly recommended to use your own private relay since public relays may l For a private relay you can for example use [nostr-rs-relay](https://github.com/scsibug/nostr-rs-relay) with ``pubkey_whitelist`` set to both ``clientkey_public`` and ``walletkey_public`` (returned from ``nip47-create``/``nip47-list``). ## Options -* ``nip47-relays``: Specify the relays that you want to use with your NWC. Can be set multiple times to use multiple relays. NWC's you create will save these and even if you add or remove relays keep the relays from the moment you created that NWC. You must set this atleast one time. +* ``nip47-relays``: Specify the relays that you want to use with your NWC. Can be set multiple times to use multiple relays. NWC's you create will save these and even if you add or remove relays keep the relays from the moment you created that NWC. If you don't set this yourself these default relays will be used: + * ``wss://nos.lol`` + * ``wss://relay.primal.net`` + * ``wss://relay.getalby.com/v1`` + * ``wss://relay.nostr.net`` + * ``wss://relay.snort.social`` * ``nip47-notifications``: Enable/disable nip47 notifications. Default is enabled (``true``) ## Methods diff --git a/src/nwc.rs b/src/nwc.rs index e6beb81..dfd0e2c 100644 --- a/src/nwc.rs +++ b/src/nwc.rs @@ -332,6 +332,12 @@ async fn nwc_request_handler( ); continue; } + for success in send_result.success { + log::trace!("Sent to {}", success.0); + } + for failure in send_result.failed { + log::trace!("Failed to send to {}: {}", failure.0, failure.1); + } log::trace!("SENT RESPONSE {response_event:?}"); } diff --git a/src/parse.rs b/src/parse.rs index e07ea53..a8f9768 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -16,19 +16,20 @@ pub async fn read_startup_options( plugin: &ConfiguredPlugin, state: &PluginState, ) -> Result<(), anyhow::Error> { - let relays_str = if let Some(relays) = plugin.option(&OPT_RELAYS).unwrap() { - if relays.is_empty() { - return Err(anyhow!( - "Empty `{}` option, must specify atleast one relay url!", - OPT_RELAYS.name() - )); - } - relays + let relays_str = if plugin + .option(&OPT_RELAYS) + .unwrap() + .is_none_or(|v| v.is_empty()) + { + vec![ + "wss://nos.lol".to_owned(), + "wss://relay.primal.net".to_owned(), + "wss://relay.getalby.com/v1".to_owned(), + "wss://relay.nostr.net".to_owned(), + "wss://relay.snort.social".to_owned(), + ] } else { - return Err(anyhow!( - "`{}` not set, must specify atleast one relay url!", - OPT_RELAYS.name() - )); + plugin.option(&OPT_RELAYS).unwrap().unwrap() }; let mut rpc = ClnRpc::new(