From 950186eca7b504de9bd7e64d233474f93e9cc73b Mon Sep 17 00:00:00 2001 From: Age Manning Date: Thu, 21 Mar 2019 11:18:47 +1100 Subject: [PATCH] Implement BeaconChainState RPC method --- beacon_node/eth2-libp2p/src/rpc/protocol.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/beacon_node/eth2-libp2p/src/rpc/protocol.rs b/beacon_node/eth2-libp2p/src/rpc/protocol.rs index 0697bdf176..b9dddb71a2 100644 --- a/beacon_node/eth2-libp2p/src/rpc/protocol.rs +++ b/beacon_node/eth2-libp2p/src/rpc/protocol.rs @@ -100,7 +100,12 @@ fn decode(packet: Vec) -> Result { BeaconBlockBodiesRequest::ssz_decode(&packet, index)?; RPCRequest::BeaconBlockBodies(block_bodies_request) } - RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod), + RPCMethod::BeaconChainState => { + let (chain_state_request, _index) = + BeaconChainStateRequest::ssz_decode(&packet, index)?; + RPCRequest::BeaconChainState(chain_state_request) + } + RPCMethod::Unknown => return Err(DecodeError::UnknownRPCMethod), }; Ok(RPCEvent::Request { @@ -129,7 +134,11 @@ fn decode(packet: Vec) -> Result { let (body, _index) = BeaconBlockBodiesResponse::ssz_decode(&packet, index)?; RPCResponse::BeaconBlockBodies(body) } - RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod), + RPCMethod::BeaconChainState => { + let (body, _index) = BeaconChainStateResponse::ssz_decode(&packet, index)?; + RPCResponse::BeaconChainState(body) + } + RPCMethod::Unknown => return Err(DecodeError::UnknownRPCMethod), }; Ok(RPCEvent::Response { id,