mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-02 17:53:52 +00:00
Bump nim-eth and nim-json-rpc
This commit is contained in:
parent
19847bbd20
commit
7d2381240f
@ -887,14 +887,10 @@ proc installBeaconApiHandlers(rpcServer: RpcServer, node: BeaconNode) =
|
||||
"Please specify one of " & astToStr(x) & " or " & astToStr(y))
|
||||
|
||||
template jsonResult(x: auto): auto =
|
||||
# TODO, yes this is silly, but teching json-rpc about
|
||||
# all beacon node types will require quite a lot of work.
|
||||
# A minor refactoring in json-rpc can solve this. We need
|
||||
# to allow the handlers to return raw/literal json strings.
|
||||
parseJson(Json.encode(x))
|
||||
StringOfJson(Json.encode(x))
|
||||
|
||||
rpcServer.rpc("getBeaconBlock") do (slot: Option[Slot],
|
||||
root: Option[Eth2Digest]) -> JsonNode:
|
||||
root: Option[Eth2Digest]) -> StringOfJson:
|
||||
requireOneOf(slot, root)
|
||||
var blockHash: Eth2Digest
|
||||
if root.isSome:
|
||||
@ -904,16 +900,16 @@ proc installBeaconApiHandlers(rpcServer: RpcServer, node: BeaconNode) =
|
||||
if foundRef.isSome:
|
||||
blockHash = foundRef.get.root
|
||||
else:
|
||||
return newJNull()
|
||||
return StringOfJson("null")
|
||||
|
||||
let dbBlock = node.db.getBlock(blockHash)
|
||||
if dbBlock.isSome:
|
||||
return jsonResult(dbBlock.get)
|
||||
else:
|
||||
return newJNull()
|
||||
return StringOfJson("null")
|
||||
|
||||
rpcServer.rpc("getBeaconState") do (slot: Option[Slot],
|
||||
root: Option[Eth2Digest]) -> JsonNode:
|
||||
root: Option[Eth2Digest]) -> StringOfJson:
|
||||
requireOneOf(slot, root)
|
||||
if slot.isSome:
|
||||
let blk = node.blockPool.head.blck.atSlot(slot.get)
|
||||
@ -925,7 +921,7 @@ proc installBeaconApiHandlers(rpcServer: RpcServer, node: BeaconNode) =
|
||||
if state.isSome:
|
||||
return jsonResult(state.get)
|
||||
else:
|
||||
return newJNull()
|
||||
return StringOfJson("null")
|
||||
|
||||
rpcServer.rpc("getNetworkPeerId") do () -> string:
|
||||
when networkBackend != libp2p:
|
||||
|
2
vendor/nim-json-rpc
vendored
2
vendor/nim-json-rpc
vendored
@ -1 +1 @@
|
||||
Subproject commit 4d1d2577e9a6634f567899b927b6dc9021624588
|
||||
Subproject commit 6fbaeb61cab889f74870372bc00cc99371e16794
|
Loading…
x
Reference in New Issue
Block a user