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

rpc/server: be more specific in some sendrawtransaction error cases #1899

Merged
merged 2 commits into from
Apr 12, 2021

Conversation

roman-khimov
Copy link
Member

Refs. #1894.

@roman-khimov roman-khimov added this to the v0.95.0 milestone Apr 9, 2021
@roman-khimov roman-khimov requested a review from AnnaShaleva April 9, 2021 21:33
@@ -1419,15 +1419,15 @@ func (s *Server) submitOracleResponse(ps request.Params) (interface{}, *response

func (s *Server) sendrawtransaction(reqParams request.Params) (interface{}, *response.Error) {
if len(reqParams) < 1 {
return nil, response.ErrInvalidParams
return nil, response.NewInvalidParamsError("not enough parameters", nil)
Copy link
Member

Choose a reason for hiding this comment

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

Then maybe we can do the same thing for submitNotaryRequest and submitBlock RPC methods?

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, updated. In general we're already better than C# node with error responses for things like verification failures (thanks to 94430ef), but these decoding/parameter errors need an improvement.

@codecov
Copy link

codecov bot commented Apr 10, 2021

Codecov Report

Merging #1899 (13619a0) into master (973ed8c) will increase coverage by 0.07%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1899      +/-   ##
==========================================
+ Coverage   82.81%   82.89%   +0.07%     
==========================================
  Files         287      287              
  Lines       22780    22780              
==========================================
+ Hits        18866    18884      +18     
+ Misses       2719     2697      -22     
- Partials     1195     1199       +4     
Impacted Files Coverage Δ
pkg/rpc/server/server.go 77.36% <87.50%> (ø)
pkg/network/metrics/metrics.go 63.63% <0.00%> (-18.19%) ⬇️
pkg/consensus/consensus.go 70.82% <0.00%> (+0.60%) ⬆️
pkg/services/oracle/request.go 53.23% <0.00%> (+5.75%) ⬆️
pkg/services/oracle/oracle.go 90.90% <0.00%> (+11.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 973ed8c...13619a0. Read the comment docs.

Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

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

Nice changes, these detailed error responces are very helpful for users.

@roman-khimov roman-khimov merged commit 1eebaa8 into master Apr 12, 2021
@roman-khimov roman-khimov deleted the more-specific-errors-for-sendrawtx branch April 12, 2021 09:17
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.

2 participants