dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

mnbudget breaks JSONRPC for strongly typed langs #989

Closed nmarley closed 8 years ago

nmarley commented 8 years ago

The mnbudget/gobject commands accept strings in place of integers which breaks JSONRPC interfaces in strongly-typed languages.

Here's an example of where getblockhash accepts an int (good):

https://github.com/dashpay/dash/blob/master/src/rpcblockchain.cpp#L251

Example of exception message:

error: JSON value is not a string as expected
tgflynn commented 8 years ago

I'm not entirely clear on what you're saying the problem is.

Are you complaining that the interface is too lenient in that it accepts strings where it should require integers or that it accepts only strings where it should be accepting integers ?

Perhaps you could provide a link to where you think the code is doing the wrong thing ?

nmarley commented 8 years ago

If I send “gobject” input as ints, I get an error, because it expects strings.

If I send “getblockhash ” as a string, I get an error, because it expects an integer.

I'm wondering if it would be easier to just change it all to accept strings and convert the datatypes on the dashd side (e.g. change the part I linked above and keep gobject commands as-is).

nmarley commented 8 years ago

I believe this is due to how I was using the library and the client lib making assumptions about the data (my fault in this case).

Closing this issue now, as I believe this was my error.