mirror of https://github.com/status-im/nim-eth.git
Fix JSON writer for logging in devp2p code (#597)
This commit is contained in:
parent
ea3c164a00
commit
25b0da0280
|
@ -138,7 +138,7 @@ proc sendNeighbours*(d: DiscoveryProtocol, node: Node, neighbours: seq[Node]) =
|
||||||
block:
|
block:
|
||||||
let payload = rlp.encode((nodes, expiration()))
|
let payload = rlp.encode((nodes, expiration()))
|
||||||
let msg = pack(cmdNeighbours, payload, d.privKey)
|
let msg = pack(cmdNeighbours, payload, d.privKey)
|
||||||
trace "Neighbours to", node, nodes
|
trace "Neighbours to", node, nodes = $nodes
|
||||||
d.send(node, msg)
|
d.send(node, msg)
|
||||||
nodes.setLen(0)
|
nodes.setLen(0)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[uri, strutils, net],
|
std/[uri, strutils, net],
|
||||||
|
pkg/chronicles,
|
||||||
../keys
|
../keys
|
||||||
|
|
||||||
export keys
|
export keys
|
||||||
|
@ -133,3 +134,6 @@ proc `$`*(a: Address): string =
|
||||||
result.add($a.ip)
|
result.add($a.ip)
|
||||||
result.add(":" & $a.udpPort)
|
result.add(":" & $a.udpPort)
|
||||||
result.add(":" & $a.tcpPort)
|
result.add(":" & $a.tcpPort)
|
||||||
|
|
||||||
|
chronicles.formatIt(Address): $it
|
||||||
|
chronicles.formatIt(ENode): $it
|
||||||
|
|
|
@ -95,6 +95,9 @@ proc `$`*(n: Node): string =
|
||||||
else:
|
else:
|
||||||
"Node[" & $n.node.address.ip & ":" & $n.node.address.udpPort & "]"
|
"Node[" & $n.node.address.ip & ":" & $n.node.address.udpPort & "]"
|
||||||
|
|
||||||
|
chronicles.formatIt(Node): $it
|
||||||
|
chronicles.formatIt(seq[Node]): $it
|
||||||
|
|
||||||
proc hash*(n: Node): hashes.Hash = hash(n.node.pubkey.toRaw)
|
proc hash*(n: Node): hashes.Hash = hash(n.node.pubkey.toRaw)
|
||||||
proc `==`*(a, b: Node): bool = (a.isNil and b.isNil) or
|
proc `==`*(a, b: Node): bool = (a.isNil and b.isNil) or
|
||||||
(not a.isNil and not b.isNil and a.node.pubkey == b.node.pubkey)
|
(not a.isNil and not b.isNil and a.node.pubkey == b.node.pubkey)
|
||||||
|
|
Loading…
Reference in New Issue