Implement BeaconChainState RPC method

This commit is contained in:
Age Manning 2019-03-21 11:18:47 +11:00
parent 3063d5eac9
commit 950186eca7
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93

View File

@ -100,7 +100,12 @@ fn decode(packet: Vec<u8>) -> Result<RPCEvent, DecodeError> {
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<u8>) -> Result<RPCEvent, DecodeError> {
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,