From 3063d5eac951d976ccd725b8cd2f6632b7c495b1 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Thu, 21 Mar 2019 11:16:09 +1100 Subject: [PATCH] Implement BeaconBlockBodies RPC method --- beacon_node/eth2-libp2p/src/rpc/protocol.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/beacon_node/eth2-libp2p/src/rpc/protocol.rs b/beacon_node/eth2-libp2p/src/rpc/protocol.rs index a15b48e08..0697bdf17 100644 --- a/beacon_node/eth2-libp2p/src/rpc/protocol.rs +++ b/beacon_node/eth2-libp2p/src/rpc/protocol.rs @@ -95,6 +95,11 @@ fn decode(packet: Vec) -> Result { BeaconBlockHeadersRequest::ssz_decode(&packet, index)?; RPCRequest::BeaconBlockHeaders(block_headers_request) } + RPCMethod::BeaconBlockBodies => { + let (block_bodies_request, _index) = + BeaconBlockBodiesRequest::ssz_decode(&packet, index)?; + RPCRequest::BeaconBlockBodies(block_bodies_request) + } RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod), }; @@ -120,6 +125,10 @@ fn decode(packet: Vec) -> Result { let (body, _index) = BeaconBlockHeadersResponse::ssz_decode(&packet, index)?; RPCResponse::BeaconBlockHeaders(body) } + RPCMethod::BeaconBlockBodies => { + let (body, _index) = BeaconBlockBodiesResponse::ssz_decode(&packet, index)?; + RPCResponse::BeaconBlockBodies(body) + } RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod), }; Ok(RPCEvent::Response {