-
Notifications
You must be signed in to change notification settings - Fork 38.7k
RPC client: Simplify command line string-to-JSON-value conversion code #4415
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the fAllowNull check. Not that I think that's critical, the server will validate the arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's intentional. It's not needed and adds no value.
|
ACK because 'better is better.' Nit: this could probably be even simpler using boost::assign::insert and assigning into a multimap<string method, int paramIdx>. See http://www.boost.org/doc/libs/1_55_0b1/libs/assign/doc/index.html |
|
Yes, ACK after code formatting nit. |
By default, all command line parameters are converted into JSON string values. There is no need to manually specify the incoming type. A binary decision "parse as string or JSON?" is all that's necessary. Convert to a simple class, initialized at runtime startup, which offers a quick lookup to answer "parse as JSON?" conversion question. Future parameter conversions need only to indicate the method name and zero-based index of the parameter needing JSON parsing.
|
Rebased + Updated to add braces. |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4415_e35b37b1b8252c3d3f66001ba1efccd263307add/ for binaries and test log. |
e35b37b RPC client: Simplify command line string-to-JSON-value conversion code (Jeff Garzik)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jgarzik Let me ask this time :), is there still an open pull, which changes this to something more readable in the near future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Diapolo Feel free to submit a cleanup PR if you desire! Thanks for asking.
By default, all command line parameters are converted into JSON string
values. There is no need to manually specify the incoming type.
A binary decision "parse as string or JSON?" is all that's necessary.
Convert to a simple class, initialized at runtime startup, which offers
a quick lookup to answer "parse as JSON?" conversion question.
Future parameter conversions need only to indicate the method name
and zero-based index of the parameter needing JSON parsing.