Skip to content

Conversation

@jgarzik
Copy link
Contributor

@jgarzik jgarzik commented Jun 25, 2014

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

@gavinandresen
Copy link
Contributor

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

@laanwj
Copy link
Member

laanwj commented Jun 26, 2014

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.
@jgarzik
Copy link
Contributor Author

jgarzik commented Jun 27, 2014

Rebased + Updated to add braces.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4415_e35b37b1b8252c3d3f66001ba1efccd263307add/ for binaries and test log.
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

@laanwj laanwj merged commit e35b37b into bitcoin:master Jun 30, 2014
laanwj added a commit that referenced this pull request Jun 30, 2014
e35b37b RPC client: Simplify command line string-to-JSON-value conversion code (Jeff Garzik)
Copy link

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?

Copy link
Contributor Author

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.

@jgarzik jgarzik deleted the rpc-type-map branch August 24, 2014 04:23
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants