Closed xeruf closed 1 month ago
You have 2 options:
A) use negentropy reconciliation with direction set to up
B) use the NostrDatabase::event_seen_on_relays
method
A) Negetropy reconciliation (supported only by strfry relays and require a persistent database):
let filter = // Your filter
let opts = NegentropyOptions::default().direction(NegentropyDirection::Up);
let output = client.reconcile(filter, opts).await?;
B) Event seen on (work also with the default in-memory database):
let database = client.database();
for id in ids {
let set = database.event_seen_on_relays(id).await?.unwrap_or_default();
if set.is_empty() { // Not seen by any relay (so probably created locally)
// Mark for broadcast
}
}
Oh there is an accessible database, that is helpful - then I might not need to retain an EventId-Event HashMap at all
I store events received (from a subscription and
get_events_of
) in the same data structure as events I newly create. When my program terminates, I want to submit the new events to the relay in a batch. Before I create a separate structure to hold events to be sent - Is there some event property that differs depending on whether the event was received from a relay or created in the program?