This PR keeps the JSON Spirit “backward-compatibility” and passes all tests. Therefore there is a new UniValue number type VREAL to distinct between int and double with the current JSON spirit precision of 8 digits after point.
Because after rfc4627 (and UniValue honors that) some basic types/strings like "null" or "0" and "string" are not valid JSON strings, i had to slightly change some unit tests (will comment below directly in the code).
in
src/bitcoin-cli.cpp:
in
0d57ecc1feoutdated
141@@ -142,8 +142,8 @@ Object CallRPC(const string& strMethod, const Array& params)
142 throw runtime_error("no response from server");
143144 // Parse reply
145- Value valReply;
146- if (!read_string(strReply, valReply))
147+ Value valReply(UniValue::VSTR);
Because now there is a distinction between int and real (to make it JSON Spirit compatible), things like -7.21 are now VREAL and no longer VNUM. I decided to make VREAL a standalone type instead of a VNUM subtype.
Edit: spelling
in
src/test/univalue_tests.cpp:
in
0d57ecc1feoutdated
I think it would be good to remove JSON Spirit in this PR while not breaking the RPC API. After this has been done, we could focus on optimizing the monetary values.
jonasschnelli force-pushed
on May 18, 2015
jonasschnelli
commented at 4:21 pm on May 18, 2015:
contributor
jgarzik
commented at 4:51 pm on May 18, 2015:
contributor
Yes, I agree JSON-spirit should be removed in this PR.
Reviewing & testing right now…
jonasschnelli force-pushed
on Jun 1, 2015
jonasschnelli force-pushed
on Jun 1, 2015
jonasschnelli
commented at 1:36 pm on June 1, 2015:
contributor
Rebased (puhh).
Thanks in advance for reviewing this (maybe @jgarzik and @theuni) and finally bring this forward.
laanwj
commented at 7:34 am on June 2, 2015:
member
(apparantly) spurious travis failure with the comparison tool, retriggering
laanwj
commented at 8:10 am on June 2, 2015:
member
Looks good to me. Tested and reviewed ACK.
Would like to merge this asap now that 0.11 is branched.
laanwj
commented at 8:43 am on June 2, 2015:
member
This breaks linearize-hashes.py. Likely, this is caused by JSON-RPC batching no longer working:
0./linearize-hashes.py linearize.cfg
1Traceback (most recent call last):
2File"./linearize-hashes.py", line 112, in<module>3 get_block_hashes(settings)
4File"./linearize-hashes.py", line 68, in get_block_hashes
5for x,resp_obj in enumerate(reply):
6TypeError: 'NoneType' object is not iterable
(expected output: a list of block hashes)
jonasschnelli
commented at 9:20 am on June 2, 2015:
contributor
Thanks for testing. Nice catch!
Will have a close look at the batching feature within the next hours.
jonasschnelli
commented at 9:41 am on June 2, 2015:
contributor
RPC batching issue is fixed.
laanwj
commented at 10:18 am on June 2, 2015:
member
Can confirm that it is fixed.
Damnit, another random travis fail.
jonasschnelli
commented at 10:30 am on June 2, 2015:
contributor
added another commit that fixes a univalue type issue within getrawmempool and getmempoolinfo
jtimon
commented at 11:00 am on June 2, 2015:
contributor
Concept ACK.
Is this getting into 0.11?
This kind of change tends to be painful to maintain…
jonasschnelli
commented at 11:36 am on June 2, 2015:
contributor
@jtimon It’s not for 0.11. It’s meant for current master which aims for 0.12.
laanwj referenced this in commit
a4993f7515
on Jun 3, 2015
laanwj referenced this in commit
46f92fc9d8
on Jun 3, 2015
laanwj referenced this in commit
4e157fc60d
on Jun 3, 2015
laanwj referenced this in commit
a7dcb7eb04
on Jun 3, 2015
laanwj referenced this in commit
5901596548
on Jun 3, 2015
laanwj referenced this in commit
181771b712
on Jun 3, 2015
laanwj
commented at 6:48 am on June 4, 2015:
member
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
9a8897f4ac
fix rpc batching univalue issue8f7e4abbe6
fix missing univalue types during constructingc7fbbc7e1d
fix univalue json parse tests519eedeba7
jonasschnelli force-pushed
on Jun 4, 2015
Simplify RPCclient, adapt json_parse_error test
# Conflicts:
# src/test/rpc_tests.cpp
043df2b568
util: Add ParseInt64 and ParseDouble functions
Strict parsing functions for other numeric types.
- ParseInt64 analogous to ParseInt32, but for 64-bit values.
- ParseDouble for doubles.
- Make all three Parse* functions more strict (e.g. reject whitespace on
the inside)
Also add tests.
7e98a3c642
univalue: add strict type checkingc02309204b
jonasschnelli force-pushed
on Jun 4, 2015
univalue: add type check unit tests44c7474446
laanwj merged this
on Jun 4, 2015
laanwj closed this
on Jun 4, 2015
laanwj referenced this in commit
466f0ea0e6
on Jun 4, 2015
sdaftuar
commented at 7:01 pm on June 4, 2015:
member
I’m getting an error now when running qa/rpc-tests/getblocktemplate_proposals.py:
JSONRPC error: Missing data String key for proposal
Looks like it’s here:
0File "./getblocktemplate_proposals.py", line 86, in assert_template
1 rsp = node.getblocktemplate({'data':template_to_hex(tmpl, txlist),'mode':'proposal'})
jonasschnelli
commented at 7:45 pm on June 4, 2015:
contributor
Meh. This bug crept in during multiple transitions from json spirit objects to UniValue.
Fixed with #6234.
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-12-19 00:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me