diff --git a/crates/nostr-sdk/src/relay/mod.rs b/crates/nostr-sdk/src/relay/mod.rs index 0ceec7a49..e7d6ec346 100644 --- a/crates/nostr-sdk/src/relay/mod.rs +++ b/crates/nostr-sdk/src/relay/mod.rs @@ -1349,7 +1349,7 @@ impl Relay { } /// Get events of filters with custom callback - pub async fn get_events_of_with_callback( + async fn get_events_of_with_callback( &self, filters: Vec, timeout: Duration, @@ -1378,13 +1378,20 @@ impl Relay { } /// Get events of filters + /// + /// Get events from local database and relay pub async fn get_events_of( &self, filters: Vec, timeout: Duration, opts: FilterOptions, ) -> Result, Error> { - let events: Mutex> = Mutex::new(Vec::new()); + let stored_events: Vec = self + .database + .query(filters.clone()) + .await + .unwrap_or_default(); + let events: Mutex> = Mutex::new(stored_events); self.get_events_of_with_callback(filters, timeout, opts, |event| async { let mut events = events.lock().await; events.push(event);