From 4105b869e1f239cb5fbbcc5a4dce17184c389e58 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Wed, 20 Mar 2019 10:54:19 +1100 Subject: [PATCH] Fix all matches relating to new RPC methods --- beacon_node/libp2p/src/rpc/protocol.rs | 12 ++++++++---- beacon_node/network/src/message_handler.rs | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/beacon_node/libp2p/src/rpc/protocol.rs b/beacon_node/libp2p/src/rpc/protocol.rs index 6cebb7fd2..c19aca8ff 100644 --- a/beacon_node/libp2p/src/rpc/protocol.rs +++ b/beacon_node/libp2p/src/rpc/protocol.rs @@ -81,7 +81,7 @@ fn decode(packet: Vec) -> Result { let (hello_body, _index) = HelloMessage::ssz_decode(&packet, index)?; RPCRequest::Hello(hello_body) } - RPCMethod::Unknown => return Err(DecodeError::UnknownRPCMethod), + RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod), }; Ok(RPCEvent::Request { @@ -97,7 +97,7 @@ fn decode(packet: Vec) -> Result { let (body, _index) = HelloMessage::ssz_decode(&packet, index)?; RPCResponse::Hello(body) } - RPCMethod::Unknown => return Err(DecodeError::UnknownRPCMethod), + RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod), }; Ok(RPCEvent::Response { id, @@ -134,8 +134,11 @@ impl Encodable for RPCEvent { s.append(id); s.append(method_id); match body { - RPCRequest::Hello(body) => s.append(body), - }; + RPCRequest::Hello(body) => { + s.append(body); + } + _ => {} + } } RPCEvent::Response { id, @@ -149,6 +152,7 @@ impl Encodable for RPCEvent { RPCResponse::Hello(response) => { s.append(response); } + _ => {} } } } diff --git a/beacon_node/network/src/message_handler.rs b/beacon_node/network/src/message_handler.rs index a7d6e3d07..4cd0ab951 100644 --- a/beacon_node/network/src/message_handler.rs +++ b/beacon_node/network/src/message_handler.rs @@ -122,6 +122,8 @@ impl MessageHandler { RPCRequest::Hello(hello_message) => { self.handle_hello_request(peer_id, id, hello_message) } + // TODO: Handle all requests + _ => {} } } @@ -138,6 +140,8 @@ impl MessageHandler { debug!(self.log, "Hello response received from peer: {:?}", peer_id); self.validate_hello(peer_id, hello_message); } + // TODO: Handle all responses + _ => {} } }