(
&self,
public_key: String,
)
| 184 | finalized_header: header.as_ssz_bytes(), |
| 185 | }) |
| 186 | } |
| 187 | |
| 188 | async fn get_latest_checkpoint(&self) -> RpcResult<CheckpointRes> { |
| 189 | let maybe_checkpoint = self.state_query.clone().get_latest_checkpoint().await; |
| 190 | |
| 191 | let (Some((checkpoint, last_block)), epoch) = maybe_checkpoint else { |
| 192 | return Err(RpcError::CheckpointNotFound.into()); |
| 193 | }; |
| 194 | |
| 195 | // try to get the finalized header for this epoch |
| 196 | let maybe_header = self.state_query.clone().get_finalized_header(epoch).await; |
| 197 | |
| 198 | let Some(header) = maybe_header else { |
| 199 | return Err(RpcError::CheckpointNotFound.into()); |
| 200 | }; |
| 201 | |
| 202 | Ok(CheckpointRes { |
| 203 | digest: checkpoint.digest.0, |
| 204 | epoch, |
| 205 | checkpoint: checkpoint.as_ssz_bytes(), |
| 206 | last_block: last_block.as_ssz_bytes(), |
| 207 | finalized_header: header.as_ssz_bytes(), |
| 208 | }) |
| 209 | } |
| 210 | |
| 211 | async fn get_latest_checkpoint_info(&self) -> RpcResult<CheckpointInfoRes> { |
| 212 | let maybe_checkpoint = self.state_query.clone().get_latest_checkpoint().await; |
| 213 | |
| 214 | let (Some((checkpoint, _)), epoch) = maybe_checkpoint else { |
| 215 | return Err(RpcError::CheckpointNotFound.into()); |
| 216 | }; |
| 217 |
nothing calls this directly
no outgoing calls
no test coverage detected