Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpc): Make RPC "incorrect parameters" error code match zcashd #6066

Merged
merged 6 commits into from
Feb 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use FutureExt::inspect() for logging, and only format on failure
teor2345 committed Jan 31, 2023

Verified

This commit was signed with the committer’s verified signature.
prabhu prabhu
commit db6da0aa41b93e1c09a2bc7215c34ae8c532c6f9
9 changes: 3 additions & 6 deletions zebra-rpc/src/server/rpc_call_compatibility.rs
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ impl<M: Metadata> Middleware<M> for FixRpcResponseMiddleware {
{
Either::Left(
next(call.clone(), meta)
.then(move |output| Self::log_error_if_method_not_found(output, call))
.inspect(|output| Self::log_error_if_method_not_found(output, call))
.boxed(),
)
}
@@ -67,9 +67,7 @@ impl FixRpcResponseMiddleware {
}

/// Check an RPC output and log an error if it indicates the method was not found.
async fn log_error_if_method_not_found(output: Option<Output>, call: Call) -> Option<Output> {
let call_description = Self::call_description(&call);

fn log_error_if_method_not_found(output: &Option<Output>, call: Call) {
if let Some(Output::Failure(Failure {
error:
Error {
@@ -79,9 +77,8 @@ impl FixRpcResponseMiddleware {
..
})) = output
{
let call_description = Self::call_description(&call);
tracing::warn!("Received unrecognized RPC request: {call_description}");
}

output
}
}