-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Description
I'm using Jan-Klaas Kollhof's JSON-RPC implementation for Python.
My app tracks amounts using the Decimal class, in order to avoid floating point representation errors.
I should be able to do:
'{"params":["15DTr7vBr9VA52cEh2k7ywPeHL9WVFadwk","3.22","comment"],"method":"sendtoaddress","id":"1305920532.77"}'
but bitcoind returns a "got string, expected real" error because "3.22" is quoted.
If I convert the value to a float, it goes like this:
'{"params":["15DTr7vBr9VA52cEh2k7ywPeHL9WVFadwk",3.219999999,"comment"],"method":"sendtoaddress","id":"1305920532.77"}'
which is a mess.
Right now, I'm hacking around this by altering the json string after building it, using the value as a string and then stripping the double quotes to change its JSON representation to a real.
Is there a reason why a string value can't be cast into a real inside bitcoind?