From f78dafb7985c4c1804adc0403c274960983456c0 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Wed, 16 Feb 2022 10:12:05 +0100 Subject: [PATCH] add some trace messages --- eth/p2p/providers.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eth/p2p/providers.nim b/eth/p2p/providers.nim index ed491f2..a8744e7 100644 --- a/eth/p2p/providers.nim +++ b/eth/p2p/providers.nim @@ -85,12 +85,14 @@ proc encode*(msg: AddProviderMessage): seq[byte] = pb.buffer proc addProviderLocal(p: ProvidersProtocol, cId: NodeId, prov: PeerRecord) = + trace "adding provider to local db", n=p.discovery.localNode, cId, prov p.providers.mgetOrPut(cId, @[]).add(prov) proc recvAddProvider(p: ProvidersProtocol, nodeId: NodeId, payload: openArray[byte]) {.raises: [Defect].} = #TODO: add checks, add signed version let msg = AddProviderMessage.decode(payload).get() + trace "<<< add_provider ", src = nodeId, dst = p.discovery.localNode.id, cid = msg.cId, prov=msg.prov p.addProviderLocal(msg.cId, msg.prov) #TODO: check that CID is reasonably close to our NodeID @@ -113,6 +115,7 @@ proc sendAddProvider*(p: ProvidersProtocol, dst: Node, cId: NodeId, pr: PeerReco proc addProvider*(p: ProvidersProtocol, cId: NodeId, pr: PeerRecord): Future[seq[Node]] {.async.} = result = await p.discovery.lookup(cId) + trace "lookup returned:", result # TODO: lookup is sepcified as not returning local, even if that is the closest. Is this OK? if result.len == 0: result.add(p.discovery.localNode)