diff --git a/crates/nostr-sdk/examples/negentropy.rs b/crates/nostr-sdk/examples/negentropy.rs index 3dc41961b..6d5223858 100644 --- a/crates/nostr-sdk/examples/negentropy.rs +++ b/crates/nostr-sdk/examples/negentropy.rs @@ -25,7 +25,7 @@ async fn main() -> Result<()> { .limit(10); let relay = client.relay("wss://relay.damus.io").await?; relay - .reconcilie(filter, my_items, Duration::from_secs(30)) + .reconcile(filter, my_items, Duration::from_secs(30)) .await?; client diff --git a/crates/nostr-sdk/src/client/mod.rs b/crates/nostr-sdk/src/client/mod.rs index c24cfe6fa..d8ecfc2fe 100644 --- a/crates/nostr-sdk/src/client/mod.rs +++ b/crates/nostr-sdk/src/client/mod.rs @@ -21,7 +21,7 @@ use nostr::types::metadata::Error as MetadataError; use nostr::url::Url; use nostr::{ ChannelId, ClientMessage, Contact, Entity, Event, EventBuilder, EventId, Filter, JsonUtil, - Keys, Kind, Metadata, Result, Tag, + Keys, Kind, Metadata, Result, Tag, Timestamp, }; use nostr_sdk_db::DynNostrDatabase; use nostr_sdk_net::futures_util::Future; @@ -1283,8 +1283,21 @@ impl Client { } /// Negentropy reconciliation - pub async fn reconcilie(&self, filter: Filter, timeout: Duration) -> Result<(), Error> { - Ok(self.pool.reconcilie(filter, timeout).await?) + pub async fn reconcile(&self, filter: Filter, timeout: Duration) -> Result<(), Error> { + Ok(self.pool.reconcile(filter, timeout).await?) + } + + /// Negentropy reconciliation with items + pub async fn reconcile_with_items( + &self, + filter: Filter, + items: Vec<(EventId, Timestamp)>, + timeout: Duration, + ) -> Result<(), Error> { + Ok(self + .pool + .reconcile_with_items(filter, items, timeout) + .await?) } /// Get a list of channels diff --git a/crates/nostr-sdk/src/relay/mod.rs b/crates/nostr-sdk/src/relay/mod.rs index 51bb97677..13cafa221 100644 --- a/crates/nostr-sdk/src/relay/mod.rs +++ b/crates/nostr-sdk/src/relay/mod.rs @@ -1470,7 +1470,7 @@ impl Relay { } /// Negentropy reconciliation - pub async fn reconcilie( + pub async fn reconcile( &self, filter: Filter, items: Vec<(EventId, Timestamp)>, @@ -1585,7 +1585,7 @@ impl Relay { let pk = Keys::generate(); let filter = Filter::new().author(pk.public_key().to_string()); match self - .reconcilie(filter, Vec::new(), Duration::from_secs(5)) + .reconcile(filter, Vec::new(), Duration::from_secs(5)) .await { Ok(_) => Ok(true), diff --git a/crates/nostr-sdk/src/relay/pool.rs b/crates/nostr-sdk/src/relay/pool.rs index 90b969e75..83b979c9f 100644 --- a/crates/nostr-sdk/src/relay/pool.rs +++ b/crates/nostr-sdk/src/relay/pool.rs @@ -861,13 +861,13 @@ impl RelayPool { } /// Negentropy reconciliation - pub async fn reconcilie(&self, filter: Filter, timeout: Duration) -> Result<(), Error> { + pub async fn reconcile(&self, filter: Filter, timeout: Duration) -> Result<(), Error> { let items: Vec<(EventId, Timestamp)> = self.database.negentropy_items(&filter).await?; - self.reconcilie_with_items(filter, items, timeout).await + self.reconcile_with_items(filter, items, timeout).await } /// Negentropy reconciliation with custom items - pub async fn reconcilie_with_items( + pub async fn reconcile_with_items( &self, filter: Filter, items: Vec<(EventId, Timestamp)>, @@ -879,8 +879,8 @@ impl RelayPool { let filter = filter.clone(); let my_items = items.clone(); let handle = thread::spawn(async move { - if let Err(e) = relay.reconcilie(filter, my_items, timeout).await { - tracing::error!("Failed to get reconcilie with {url}: {e}"); + if let Err(e) = relay.reconcile(filter, my_items, timeout).await { + tracing::error!("Failed to get reconcile with {url}: {e}"); } }); handles.push(handle);