Skip to content

Commit

Permalink
fix: state sync panics on no data (0xPolygonMiden#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
juan518munoz authored Dec 12, 2023
1 parent 3d82958 commit bb7b26b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ impl MockRpcApi {
request: impl tonic::IntoRequest<SyncStateRequest>,
) -> std::result::Result<tonic::Response<SyncStateResponse>, tonic::Status> {
let request = request.into_request().into_inner();
let response = self
.sync_state_requests
.get(&request)
.expect("no response for sync state request")
.clone();
Ok(tonic::Response::new(response))
match self.sync_state_requests.get(&request) {
Some(response) => {
let response = response.clone();
Ok(tonic::Response::new(response))
}
None => Err(tonic::Status::not_found(
"no response for sync state request",
)),
}
}
}

Expand Down

0 comments on commit bb7b26b

Please sign in to comment.