Provide empty RLP list data for devp2p ping/pong messages, for Parity compatibility

This commit is contained in:
kdeme 2019-07-03 18:51:12 +02:00
parent 325d120274
commit 3d2436d3df
1 changed files with 8 additions and 3 deletions

View File

@ -20,6 +20,8 @@ type
ResponderWithoutId*[MsgType] = distinct Peer ResponderWithoutId*[MsgType] = distinct Peer
EmptyList = object
const const
devp2pVersion* = 4 devp2pVersion* = 4
maxMsgSize = 1024 * 1024 maxMsgSize = 1024 * 1024
@ -777,10 +779,13 @@ p2pProtocol devp2p(version = 0, shortName = "p2p"):
proc sendDisconnectMsg(peer: Peer, reason: DisconnectionReason) proc sendDisconnectMsg(peer: Peer, reason: DisconnectionReason)
proc ping(peer: Peer) = # Adding an empty RLP list as the spec defines.
discard peer.pong() # 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 discard
proc removePeer(network: EthereumNode, peer: Peer) = proc removePeer(network: EthereumNode, peer: Peer) =