RPC client: Simplify command line string-to-JSON-value conversion code#4415
RPC client: Simplify command line string-to-JSON-value conversion code#4415laanwj merged 1 commit intobitcoin:masterfrom
Conversation
There was a problem hiding this comment.
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.
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.
@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.
@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.