compiler segfault

This commit is contained in:
Daniil Sobol 2023-10-12 16:51:12 +03:00
parent ee7036a43a
commit 381b0831cc
No known key found for this signature in database
GPG Key ID: 5121E3B3F2304E22
1 changed files with 6 additions and 5 deletions

View File

@ -19,7 +19,8 @@ import
../../seed_db,
"."/[portal_stream, portal_protocol_config],
../state/state_distance,
./messages
./messages,
sugar
export messages, routing_table, protocol
@ -242,10 +243,10 @@ func `$`(id: PortalProtocolId): string =
id.toHex()
proc getIp(address: Option[Address]): string =
address.map(proc (a:Address):string = $a.ip).get("0.0.0.0")
address.map((a) => $a.ip).get("0.0.0.0")
proc getPort(address: Option[Address]): string =
address.map(proc (a:Address):string = $a.port).get("0")
address.map((a) => $a.port).get("0")
proc addNode*(p: PortalProtocol, node: Node): NodeStatus =
p.routingTable.addNode(node)
@ -1123,7 +1124,7 @@ proc traceContentLookup*(p: PortalProtocol, target: ByteList, targetId: UInt256)
metadata["0x" & $p.localNode.id] = NodeMetadata(
enr: p.localNode.record,
ip: getIp(p.localNode.address),
port: getPort(p.localNode.address),
port: p.localNode.address.map((a) => $a.port).get("0"),
distance: p.routingTable.distance(p.localNode.id, targetId)
)
@ -1131,7 +1132,7 @@ proc traceContentLookup*(p: PortalProtocol, target: ByteList, targetId: UInt256)
metadata["0x" & $cn.id] = NodeMetadata(
enr: cn.record,
ip: getIp(cn.address),
port: getPort(cn.address),
port: cn.address.map((a) => $a.port).get("0"),
distance: p.routingTable.distance(cn.id, targetId)
)