Implement BeaconBlockHeaders RPC method

This commit is contained in:
Age Manning 2019-03-21 11:05:26 +11:00
parent 766a79adfa
commit 56cd77ead8
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93

View File

@ -90,6 +90,11 @@ fn decode(packet: Vec<u8>) -> Result<RPCEvent, DecodeError> {
BeaconBlockRootsRequest::ssz_decode(&packet, index)?;
RPCRequest::BeaconBlockRoots(block_roots_request)
}
RPCMethod::BeaconBlockHeaders => {
let (block_headers_request, _index) =
BeaconBlockHeadersRequest::ssz_decode(&packet, index)?;
RPCRequest::BeaconBlockHeaders(block_headers_request)
}
RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod),
};
@ -111,6 +116,10 @@ fn decode(packet: Vec<u8>) -> Result<RPCEvent, DecodeError> {
let (body, _index) = BeaconBlockRootsResponse::ssz_decode(&packet, index)?;
RPCResponse::BeaconBlockRoots(body)
}
RPCMethod::BeaconBlockHeaders => {
let (body, _index) = BeaconBlockHeadersResponse::ssz_decode(&packet, index)?;
RPCResponse::BeaconBlockHeaders(body)
}
RPCMethod::Unknown | _ => return Err(DecodeError::UnknownRPCMethod),
};
Ok(RPCEvent::Response {