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

rpcserver: Fix Error message returned by processRequest #1695

Merged
merged 1 commit into from
Mar 9, 2021

Conversation

qustavo
Copy link
Contributor

@qustavo qustavo commented Mar 9, 2021

When processRequest can't find a rpc command, standardCmdResult returns a btcjson.ErrRPCMethodNotFound but it gets ignored and a btcjson.ErrRPCInvalidRequest is returned instead.

For example when I run the createwallet command

btcctl --simnet --rpcuser=foo --rpcpass=bar createwallet testWallet

This is the error message I get:

-32600: Invalid request: malformed

But instead I should get this (returned by standardCmdResult)

-32601: Method not found

This fixes processRequest behavior to return the right error message.

When processRequest can't find a rpc command, standardCmdResult returns
a `btcjson.ErrRPCMethodNotFound` but it gets ignored and a
`btcjson.ErrRPCInvalidRequest` is returned instead.

This makes processRequest return the right error message.
@coveralls
Copy link

coveralls commented Mar 9, 2021

Pull Request Test Coverage Report for Build 636199679

  • 0 of 7 (0.0%) changed or added relevant lines in 1 file are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.009%) to 52.843%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcserver.go 0 7 0.0%
Files with Coverage Reduction New Missed Lines %
btcec/signature.go 3 92.76%
peer/peer.go 3 75.63%
Totals Coverage Status
Change from base Build 624441762: -0.009%
Covered Lines: 20921
Relevant Lines: 39591

💛 - Coveralls

Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.
OK

@jcvernaleo
Copy link
Member

@gchaincl looks good but any chance you could squash these to one commit (with just the one commit message)?

Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change is good but if possible, squash would be nice to keep history clean.

Thanks!

@qustavo
Copy link
Contributor Author

qustavo commented Mar 9, 2021

Sure, will do

@qustavo
Copy link
Contributor Author

qustavo commented Mar 9, 2021

@jcvernaleo commits squashed

Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@jcvernaleo jcvernaleo merged commit 556620f into btcsuite:master Mar 9, 2021
@qustavo qustavo deleted the rpc-jsonerror-msg branch March 9, 2021 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants