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: return rule error on rejected raw tx #808

Merged
merged 1 commit into from
Sep 14, 2017

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented Aug 10, 2017

Closes #733

Copy link
Member

@jrick jrick left a comment

Choose a reason for hiding this comment

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

This will need some changes.

First off, the comment above is now wrong because it talks about how it is not returning a deserialization error, yet now it does.

Second, this is not the behavior we really want, even if this is what bitcoind does (or did at time of comment). What we do want is to use an error code that specifies that the input was rejected due to either consensus or policy rules. Unfortunately, no such error code exists at this time. I think we should cross reference bitcoind to see if they have added anything to handle this and if so use it, otherwise we can add our own error code.

Finally, the first line of the commit message makes no sense. This change does not touch the wire package at all, and instead only affects the JSON-RPC server.

@dnldd dnldd force-pushed the sendrawtransaction branch from ca5b125 to f0c21a0 Compare August 10, 2017 12:11
@dnldd dnldd changed the title wire: return deserialization err. on rejected rawtx rpcserver: return deserialization err. on rejected rawtx Aug 10, 2017
@dnldd dnldd force-pushed the sendrawtransaction branch from f0c21a0 to 5f04432 Compare August 10, 2017 12:52
@dnldd dnldd changed the title rpcserver: return deserialization err. on rejected rawtx rpcserver: return rule error on rejected raw tx Aug 10, 2017
@dnldd
Copy link
Member Author

dnldd commented Aug 10, 2017

I've cross referenced with bitcoind and it's also using the deserialization error type for the rule error case. Now using dcrjson.ErrRPCMisc to represent a rule error.

rpcserver.go Outdated
} else {
rpcsLog.Errorf("Failed to process transaction %v: %v",
tx.Hash(), err)
rpcsLog.Debugf(err.Error(), "")
Copy link
Member

Choose a reason for hiding this comment

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

All of these should use "%v" or "%s" as the format string, not the error string.

@dnldd dnldd force-pushed the sendrawtransaction branch from 5f04432 to 8bbe65e Compare September 12, 2017 21:37
@dnldd
Copy link
Member Author

dnldd commented Sep 12, 2017

@jrick updated the PR per your review.

@dnldd dnldd force-pushed the sendrawtransaction branch from 8bbe65e to 4438181 Compare September 12, 2017 21:50
@davecgh davecgh merged commit fd924aa into decred:master Sep 14, 2017
@dnldd dnldd deleted the sendrawtransaction branch June 4, 2018 23:24
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