From 3d2436d3df7c3503789c4c0a77148df19f622c95 Mon Sep 17 00:00:00 2001 From: kdeme Date: Wed, 3 Jul 2019 18:51:12 +0200 Subject: [PATCH] Provide empty RLP list data for devp2p ping/pong messages, for Parity compatibility --- eth/p2p/rlpx.nim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eth/p2p/rlpx.nim b/eth/p2p/rlpx.nim index 0a736a7..6818f37 100644 --- a/eth/p2p/rlpx.nim +++ b/eth/p2p/rlpx.nim @@ -20,6 +20,8 @@ type ResponderWithoutId*[MsgType] = distinct Peer + EmptyList = object + const devp2pVersion* = 4 maxMsgSize = 1024 * 1024 @@ -777,10 +779,13 @@ p2pProtocol devp2p(version = 0, shortName = "p2p"): proc sendDisconnectMsg(peer: Peer, reason: DisconnectionReason) - proc ping(peer: Peer) = - discard peer.pong() + # Adding an empty RLP list as the spec defines. + # The parity client specifically checks if there is rlp data. + # TODO: can we do this in the macro instead? + proc ping(peer: Peer, emptyList: EmptyList) = + discard peer.pong(EmptyList()) - proc pong(peer: Peer) = + proc pong(peer: Peer, emptyList: EmptyList) = discard proc removePeer(network: EthereumNode, peer: Peer) =