Use error code -1 for incorrect RPC parameters #6054
Labels
A-compatibility
Area: Compatibility with other nodes or wallets, or standard rules
A-rpc
Area: Remote Procedure Call interfaces
C-bug
Category: This is a bug
Motivation
node-stratum-pool
expects a-1
error code when the RPC parameters are incorrect, butjsonrpc_core
provides code-32602
by default:https://github.com/s-nomp/node-stratum-pool/blob/d86ae73f8ff968d9355bb61aac05e0ebef36ccb5/lib/pool.js#L459-L461
equihash-solomining logs:
Complex Code or Requirements
I think we can fix this by changing the error code in an
IoHandler
, after doing the RPC call:https://docs.rs/jsonrpc-core/18.0.0/jsonrpc_core/struct.IoHandler.html#method.handle_call
This is very similar to our existing
TracingMiddleware
, we just need to change the error code in the "incorrect parameters" case:zebra/zebra-rpc/src/server/tracing_middleware.rs
Lines 57 to 67 in 9b1d265
Testing
We can manually test this with
equihash-solomining
ors-nomp
.We might be able to do a snapshot test for
submitblock
with no arguments, but we'd have to run the whole RPC server to do it. (Calling the RPC function directly doesn't work, because Rust requires valid arguments to compile.)Related Work
This blocks #5934 with both
equihash-solomining
ands-nomp
.The only other error codes I could find are in the payment code, which Zebra doesn't support because it doesn't have a wallet:
https://github.com/s-nomp/s-nomp/blob/8567a4c649ab6f5ea37ac3c3901f2d9c2597199a/libs/paymentProcessor.js#L750
The text was updated successfully, but these errors were encountered: