From 0847eec6e0f28a2d37cd5b7aa8da65f2499b1032 Mon Sep 17 00:00:00 2001 From: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Date: Wed, 8 Jun 2022 11:20:18 +0200 Subject: [PATCH] chore: reduce unnecessary logging (#991) --- waku/v2/node/peer_manager/peer_manager.nim | 5 +++++ waku/v2/node/wakunode2.nim | 9 ++++++--- waku/v2/protocol/waku_store/waku_store.nim | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/waku/v2/node/peer_manager/peer_manager.nim b/waku/v2/node/peer_manager/peer_manager.nim index 066ced644..e1e0c9028 100644 --- a/waku/v2/node/peer_manager/peer_manager.nim +++ b/waku/v2/node/peer_manager/peer_manager.nim @@ -107,6 +107,11 @@ proc loadFromStorage(pm: PeerManager) = ################## proc onConnEvent(pm: PeerManager, peerId: PeerID, event: ConnEvent) {.async.} = + if not pm.peerStore.addressBook.contains(peerId): + ## We only consider connection events if we + ## already track some addresses for this peer + return + case event.kind of ConnEventKind.Connected: pm.peerStore.connectionBook[peerId] = Connected diff --git a/waku/v2/node/wakunode2.nim b/waku/v2/node/wakunode2.nim index 0bf813ebe..eff4ed678 100644 --- a/waku/v2/node/wakunode2.nim +++ b/waku/v2/node/wakunode2.nim @@ -500,7 +500,7 @@ when defined(rln): ## if contentTopic is empty, then validation takes place for All the messages published on the given pubsubTopic ## the message validation logic is according to https://rfc.vac.dev/spec/17/ proc validator(topic: string, message: messages.Message): Future[pubsub.ValidationResult] {.async.} = - debug "rln-relay topic validator is called" + trace "rln-relay topic validator is called" let msg = WakuMessage.init(message.data) if msg.isOk(): let @@ -509,7 +509,7 @@ when defined(rln): # check the contentTopic if (wakumessage.contentTopic != "") and (contentTopic != "") and (wakumessage.contentTopic != contentTopic): - debug "content topic did not match:", contentTopic=wakumessage.contentTopic, payload=payload + trace "content topic did not match:", contentTopic=wakumessage.contentTopic, payload=payload return pubsub.ValidationResult.Accept # validate the message @@ -1044,8 +1044,9 @@ when isMainModule: # 2/7 Retrieve dynamic bootstrap nodes proc retrieveDynamicBootstrapNodes(conf: WakuNodeConf): SetupResult[seq[RemotePeerInfo]] = - # DNS discovery + if conf.dnsDiscovery and conf.dnsDiscoveryUrl != "": + # DNS discovery debug "Discovering nodes using Waku DNS discovery", url=conf.dnsDiscoveryUrl var nameServers: seq[TransportAddress] @@ -1066,6 +1067,8 @@ when isMainModule: .mapErr(proc (e: cstring): string = $e) else: warn "Failed to init Waku DNS discovery" + + ok(newSeq[RemotePeerInfo]()) # Return an empty seq by default # 3/7 Initialize node proc initNode(conf: WakuNodeConf, diff --git a/waku/v2/protocol/waku_store/waku_store.nim b/waku/v2/protocol/waku_store/waku_store.nim index 971faf8cd..6fab7d409 100644 --- a/waku/v2/protocol/waku_store/waku_store.nim +++ b/waku/v2/protocol/waku_store/waku_store.nim @@ -619,7 +619,7 @@ proc resume*(ws: WakuStore, peerList: Option[seq[RemotePeerInfo]] = none(seq[Rem # if no peerList is set then query from one of the peers stored in the peer manager let peerOpt = ws.peerManager.selectPeer(WakuStoreCodec) if peerOpt.isNone(): - error "no suitable remote peers" + warn "no suitable remote peers" waku_store_errors.inc(labelValues = [dialFailure]) return err("no suitable remote peers")