Implementation of beacon_pool_attester_slashings(), beacon_pool_proposer_slashings() and beacon_pool_voluntary_exits().

This commit is contained in:
cheatfate 2020-11-30 05:14:40 +02:00 committed by zah
parent 027d2547cd
commit 6cae25701b
1 changed files with 24 additions and 9 deletions

View File

@ -5,7 +5,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
std/[parseutils, sequtils, strutils], std/[parseutils, sequtils, strutils, deques],
json_rpc/[rpcserver, jsonmarshal], json_rpc/[rpcserver, jsonmarshal],
chronicles, chronicles,
@ -245,20 +245,35 @@ proc installBeaconApiHandlers*(rpcServer: RpcServer, node: BeaconNode) =
node.sendAttestation(attestation) node.sendAttestation(attestation)
return true return true
rpcServer.rpc("get_v1_beacon_pool_attester_slahsings") do () -> JsonNode: rpcServer.rpc("get_v1_beacon_pool_attester_slashings") do (
) -> seq[AttesterSlashing]:
let length = len(node.exitPool.attester_slashings)
var res = newSeqOfCap[AttesterSlashing](length)
for item in node.exitPool.attester_slashings.items():
res.add(item)
return res
rpcServer.rpc("post_v1_beacon_pool_attester_slashings") do () -> JsonNode:
unimplemented() unimplemented()
rpcServer.rpc("post_v1_beacon_pool_attester_slahsings") do () -> JsonNode: rpcServer.rpc("get_v1_beacon_pool_proposer_slashings") do (
unimplemented() ) -> seq[ProposerSlashing]:
let length = len(node.exitPool.proposer_slashings)
rpcServer.rpc("get_v1_beacon_pool_proposer_slashings") do () -> JsonNode: var res = newSeqOfCap[ProposerSlashing](length)
unimplemented() for item in node.exitPool.proposer_slashings.items():
res.add(item)
return res
rpcServer.rpc("post_v1_beacon_pool_proposer_slashings") do () -> JsonNode: rpcServer.rpc("post_v1_beacon_pool_proposer_slashings") do () -> JsonNode:
unimplemented() unimplemented()
rpcServer.rpc("get_v1_beacon_pool_voluntary_exits") do () -> JsonNode: rpcServer.rpc("get_v1_beacon_pool_voluntary_exits") do (
unimplemented() ) -> seq[SignedVoluntaryExit]:
let length = len(node.exitPool.voluntary_exits)
var res = newSeqOfCap[SignedVoluntaryExit](length)
for item in node.exitPool.voluntary_exits.items():
res.add(item)
return res
rpcServer.rpc("post_v1_beacon_pool_voluntary_exits") do ( rpcServer.rpc("post_v1_beacon_pool_voluntary_exits") do (
exit: SignedVoluntaryExit) -> bool: exit: SignedVoluntaryExit) -> bool: