Fix identify log for json_sink (#690)

This commit is contained in:
Tanguy 2022-02-01 18:35:48 +01:00 committed by GitHub
parent 07da14a7a7
commit 00e1f9342f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -9,7 +9,7 @@
{.push raises: [Defect].}
import options
import std/[sequtils, options, strutils]
import chronos, chronicles
import ../protobuf/minprotobuf,
../peerinfo,
@ -107,11 +107,14 @@ proc decodeMsg*(buf: seq[byte]): Option[IdentifyInfo] =
iinfo.protoVersion = some(protoVersion)
if r6.get():
iinfo.agentVersion = some(agentVersion)
debug "decodeMsg: decoded message", pubkey = ($pubkey).shortLog,
addresses = $iinfo.addrs, protocols = $iinfo.protos,
observable_address = $iinfo.observedAddr,
proto_version = $iinfo.protoVersion,
agent_version = $iinfo.agentVersion
debug "decodeMsg: decoded identify", pubkey = ($pubkey).shortLog,
addresses = iinfo.addrs.mapIt($it).join(","),
protocols = iinfo.protos.mapIt($it).join(","),
observable_address =
if iinfo.observedAddr.isSome(): $iinfo.observedAddr.get()
else: "None",
proto_version = iinfo.protoVersion.get("None"),
agent_version = iinfo.agentVersion.get("None")
some(iinfo)
else:
trace "decodeMsg: failed to decode received message"