Adjust discv5_updateNodeInfo JSON-RPC to specify key and value (#1569)

This commit is contained in:
Kim De Mey 2023-05-09 14:34:01 +02:00 committed by GitHub
parent cdfc99e4f7
commit 9097548a10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -30,10 +30,9 @@ proc installDiscoveryApiHandlers*(rpcServer: RpcServer|RpcProxy,
return d.routingTable.getNodeInfo()
rpcServer.rpc("discv5_updateNodeInfo") do(
kvPairs: seq[(string, string)]) -> NodeInfo:
# TODO: Not according to spec, as spec parameters are weird.
# It is currently as in
# https://ddht.readthedocs.io/en/latest/jsonrpc.html#discv5-updatenodeinfo
kvPairs: seq[tuple[key: string, value: string]]) -> NodeInfo:
# TODO: Not according to spec, as spec only allows socket address.
# portal-specs PR has been created with suggested change as is here.
let enrFields = kvPairs.map(
proc(n: (string, string)): (string, seq[byte]) {.raises: [ValueError].} =
(n[0], hexToSeqByte(n[1]))