Skip to content

Commit

Permalink
add suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
oxarbitrage committed Dec 20, 2024
1 parent 06cd958 commit a9e26fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
2 changes: 2 additions & 0 deletions zebra-rpc/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pub struct Config {
/// We keep it just for backward compatibility but it actually do nothing.
/// It was something configurable when the RPC server was based in the jsonrpc-core crate,
/// not anymore since we migrated to jsonrpsee.
// TODO: Prefix this field name with an underscore so it's clear that it's now unused, and
// use serde(rename) to continue successfully deserializing old configs.
pub parallel_cpu_threads: usize,

/// Test-only option that makes Zebra say it is at the chain tip,
Expand Down
2 changes: 1 addition & 1 deletion zebra-rpc/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ where
match nix::sys::signal::raise(nix::sys::signal::SIGINT) {
Ok(_) => Ok("Zebra server stopping".to_string()),
Err(error) => Err(ErrorObject::owned(
ErrorCode::ServerError(ErrorCode::InternalError.code()).code(),
ErrorCode::InternalError.code(),
format!("Failed to shut down: {}", error).as_str(),
None::<()>,
)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@ where
let block_verifier_router_response = block_verifier_router
.ready()
.await
.map_err(|error| {
ErrorObject::owned(
ErrorCode::ServerError(0).code(),
error.to_string(),
None::<()>,
)
})?
.map_err(|error| ErrorObject::owned(0, error.to_string(), None::<()>))?
.call(zebra_consensus::Request::CheckProposal(Arc::new(block)))
.await;

Expand Down Expand Up @@ -223,13 +217,10 @@ where
+ 'static,
{
let request = zebra_state::ReadRequest::ChainInfo;
let response = state.oneshot(request.clone()).await.map_err(|error| {
ErrorObject::owned(
ErrorCode::ServerError(0).code(),
error.to_string(),
None::<()>,
)
})?;
let response = state
.oneshot(request.clone())
.await
.map_err(|error| ErrorObject::owned(0, error.to_string(), None::<()>))?;

let chain_info = match response {
zebra_state::ReadResponse::ChainInfo(chain_info) => chain_info,
Expand Down Expand Up @@ -259,13 +250,7 @@ where
let response = mempool
.oneshot(mempool::Request::FullTransactions)
.await
.map_err(|error| {
ErrorObject::owned(
ErrorCode::ServerError(0).code(),
error.to_string(),
None::<()>,
)
})?;
.map_err(|error| ErrorObject::owned(0, error.to_string(), None::<()>))?;

// TODO: Order transactions in block templates based on their dependencies

Expand Down

0 comments on commit a9e26fd

Please sign in to comment.