Skip to content

Commit decfbcc

Browse files
committed
sdk: log notices from relays
1 parent a6fca2b commit decfbcc

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

crates/nostr-sdk/src/relay/pool.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,24 @@ impl RelayPoolTask {
159159
msg.clone(),
160160
));
161161

162-
if let RelayMessage::Event { event, .. } = msg {
163-
// Verifies if the event is valid
164-
if event.verify().is_ok() {
165-
// Adds only new events
166-
if this.add_event(event.id).await {
167-
let notification = RelayPoolNotification::Event(
168-
relay_url,
169-
event.as_ref().clone(),
170-
);
171-
let _ = this.notification_sender.send(notification);
162+
match msg {
163+
RelayMessage::Event { event, .. } => {
164+
// Verifies if the event is valid
165+
if event.verify().is_ok() {
166+
// Adds only new events
167+
if this.add_event(event.id).await {
168+
let notification = RelayPoolNotification::Event(
169+
relay_url,
170+
event.as_ref().clone(),
171+
);
172+
let _ = this.notification_sender.send(notification);
173+
}
172174
}
173175
}
176+
RelayMessage::Notice { message } => {
177+
tracing::warn!("Notice from {relay_url}: {message}")
178+
}
179+
_ => (),
174180
}
175181
}
176182
RelayPoolMessage::BatchEvent(ids) => {

0 commit comments

Comments
 (0)