Skip to content

Commit

Permalink
fix: Map correct status values
Browse files Browse the repository at this point in the history
  • Loading branch information
morgsmccauley committed Dec 21, 2023
1 parent 3e8307e commit affe292
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions block-streamer/src/server/block_streamer_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ impl BlockStreamerService {

fn match_status(grpc_status: i32) -> Result<registry_types::Status, Status> {
match grpc_status {
0 => Ok(registry_types::Status::Success),
1 => Ok(registry_types::Status::Fail),
2 => Ok(registry_types::Status::Any),
_ => Err(Status::invalid_argument(
"Invalid status value for ActionAnyRule",
)),
1 => Ok(registry_types::Status::Success),
2 => Ok(registry_types::Status::Fail),
3 => Ok(registry_types::Status::Any),
status => Err(Status::invalid_argument(format!(
"Invalid Status provided: {}",
status
))),
}
}
}
Expand Down Expand Up @@ -241,7 +242,7 @@ mod tests {
version: 0,
rule: Some(start_stream_request::Rule::ActionAnyRule(ActionAnyRule {
affected_account_id: "queryapi.dataplatform.near".to_string(),
status: 0,
status: 1,
})),
}))
.await
Expand Down Expand Up @@ -274,7 +275,7 @@ mod tests {
version: 0,
rule: Some(start_stream_request::Rule::ActionAnyRule(ActionAnyRule {
affected_account_id: "queryapi.dataplatform.near".to_string(),
status: 0,
status: 1,
})),
}))
.await
Expand Down

0 comments on commit affe292

Please sign in to comment.