You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug #1 : spaces inside single quotes are not preserved for method arguments.
E.g. run listunspent, then try to copy and paste one of the unspent inputs into a createrawtransaction '[...unspent...]' '{"...address...":1}'
You have to delete all of the spaces in the listunspent output for it to work.
Bug #2 : you have to put JSON arrays/objects inside single quotes. It would be really nice if the QT debug window was smart enough to not require that. Can the json spirit code read from a stream?
#1 sounds like a bug, #2 is not a bug though: the console emulates a 'bash' console with bitcoind, which also needs JSON arrays/objects quoted.
I'm sure it's possible to switch to "JSON objects separated by spaces", or even full javascript syntax (Qt has a js interpreter, QtScript), but that would be a complete break from what we've done until now.
I'm not able to reproduce #1. To check space handling, I've temporarily added a command test that simply prints the first argument:
19:53:45 test " 1234 "
19:53:45 " 1234 "
19:53:49 test ' 1234 '
19:53:49 " 1234 "
Spaces inside both single and double quotes seem to be handled as expected, at least by the console code. There might be something deeper in RPCConvertValues that causes the problem, but then you'd expect it as well when you use bitcoind as RPC client on the command line.
Can you give exact input that produces the problem?
That leaves "JSON objects directly on the command line".
I think it could be done unambiguously by detecting unquoted arguments that start with '[' or '{' as the beginning of a JSON object, and then attempting to read a full JSON object using json_spirit, and continuing at the position where it stopped parsing (if that's available somewhere). It would mess up the pretty little state machine in parseCommandLine though...
Either that, or go all the way and integrate a Javascript interpreter using QScript. One could use normal function calls, ie createrawtransaction([{...}], "test"). You could even store the return values and use them in a next call, or run them through a script first. But I'm somewhat wary of pulling in a script interpreter, as it will increase the attack surface.
Nah... this is very low priority, the console is already useful and I'm not sure that we need to make it even more developer friendly :-) Hmm... Or maybe that's the future niche of Bitcoin-Qt, "the debug client", as Sipa is talking about directing normal users to faster lightweight clients already.
Activity
laanwj commentedon Sep 18, 2012
#1 sounds like a bug, #2 is not a bug though: the console emulates a 'bash' console with bitcoind, which also needs JSON arrays/objects quoted.
I'm sure it's possible to switch to "JSON objects separated by spaces", or even full javascript syntax (Qt has a js interpreter, QtScript), but that would be a complete break from what we've done until now.
laanwj commentedon Sep 18, 2012
I'm not able to reproduce #1. To check space handling, I've temporarily added a command
testthat simply prints the first argument:19:53:45 test " 1234 "
19:53:45 " 1234 "
19:53:49 test ' 1234 '
19:53:49 " 1234 "
Spaces inside both single and double quotes seem to be handled as expected, at least by the console code. There might be something deeper in
RPCConvertValuesthat causes the problem, but then you'd expect it as well when you usebitcoindas RPC client on the command line.Can you give exact input that produces the problem?
gavinandresen commentedon Sep 18, 2012
Weird... I cannot reproduce #1 now with a fresh build, I'll verify on a 0.7.0 release binary.
Input that was causing my trouble before:
createrawtransaction '[{
"txid" : "f28346bb47465584cfe65c1bf72b5a2f66ac40a4565a45d33b6e0b87ffd57637",
"vout" : 0}]' '{"19DtwBKG7YHYTVraX6QWTv4Lb6nBxfWWSf":0.925}'
UPDATED: verified, works great on 0.7.0 final, maybe I was running an old release candidate Bitcoin-Qt by accident...
laanwj commentedon Sep 19, 2012
That leaves "JSON objects directly on the command line".
parseCommandLinethough...createrawtransaction([{...}], "test"). You could even store the return values and use them in a next call, or run them through a script first. But I'm somewhat wary of pulling in a script interpreter, as it will increase the attack surface.Nah... this is very low priority, the console is already useful and I'm not sure that we need to make it even more developer friendly :-) Hmm... Or maybe that's the future niche of Bitcoin-Qt, "the debug client", as Sipa is talking about directing normal users to faster lightweight clients already.
Merge bitcoin#1831: [RPC] re introducing filtering args in getbalance
Squashed 'src/secp256k1/' changes from 7262adb4b4..bd0287d650