Fix all matches relating to new RPC methods

This commit is contained in:
Age Manning 2019-03-20 10:54:19 +11:00
parent 9db36f15bf
commit 4105b869e1
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93
2 changed files with 12 additions and 4 deletions

View File

@ -81,7 +81,7 @@ fn decode(packet: Vec<u8>) -> Result<RPCEvent, DecodeError> {
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<u8>) -> Result<RPCEvent, DecodeError> {
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);
}
_ => {}
}
}
}

View File

@ -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
_ => {}
}
}