Wladimir J. van der Laan
fed500e2dd
rpc: Accept scientific notation for monetary amounts in JSON
...
Add a function `ParseFixedPoint` that parses numbers according
to the JSON number specification and returns a 64-bit integer.
Then this in `AmountFromValue`, rather than `ParseMoney`.
Also add lots of tests (thanks to @jonasschnelli for some of them).
Fixes issue #6297 .
2017-02-10 02:18:58 +00:00
Wladimir J. van der Laan
e76a3849c6
Changes necessary now that zero values accepted in AmountFromValue
...
- Add an accept test for zero amounts, and a reject test for negative
amounts
- Remove ugly hack in `settxfee` that is no longer necessary
- Do explicit zero checks in wallet RPC functions
- Don't add a check for zero amounts in `createrawtransaction` - this
could be seen as a feature
2017-02-10 02:18:57 +00:00
Wladimir J. van der Laan
a5beb3a51b
Get rid of fPlus argument to FormatMoney
...
It's never used with any other value than false, the default.
2017-02-10 02:18:55 +00:00
Wladimir J. van der Laan
c66dff3dc7
Don't go through double in AmountFromValue and ValueFromAmount
...
My prime gripe with JSON spirit was that monetary values still had to be
converted from and to floating point which can cause deviations (see #3759
and https://bitcoin.stackexchange.com/questions/22716/bitcoind-sendfrom-round-amount-error ).
As UniValue stores internal values as strings, this is no longer
necessary. This avoids risky double-to-integer and integer-to-double
conversions completely, and results in more elegant code to boot.
2017-02-10 02:18:54 +00:00
Jonas Schnelli
fbc98d7720
remove $(@F) and subdirs from univalue make
2017-02-10 02:18:52 +00:00
Jonas Schnelli
a10a6e2a0e
[Univalue] add univalue over subtree
...
similar to secp256k1 include and compile univalue over a subtree
2017-02-10 02:18:51 +00:00
Jack Grigg
0025fb4b0e
Merge commit 'a4071034f6ad640ef91057fa3f45098c4933f444' as 'src/univalue'
2017-02-10 02:18:46 +00:00
Jack Grigg
a4071034f6
Squashed 'src/univalue/' content from commit 9ef5b78
...
git-subtree-dir: src/univalue
git-subtree-split: 9ef5b78c1998509b8f1ccd76f0aee15140e384be
2017-02-10 02:18:44 +00:00
Jonas Schnelli
7fc7bab25d
remove univalue, prepare for subtree
2017-02-10 00:56:22 +00:00
Jack Grigg
02972a1bcd
[cleanup] Simplify test code
2017-02-10 00:53:15 +00:00
Jack Grigg
873c40365a
[cleanup] Remove unused import
2017-02-10 00:53:14 +00:00
Jack Grigg
cc71666a51
unsigned int -> size_t for comparing with UniValue.size()
2017-02-10 00:53:13 +00:00
Jack Grigg
0821ddb0de
Remove JSON Spirit from contrib/debian/copyright
2017-02-10 00:53:11 +00:00
Jack Grigg
5fb326d41d
Manually iterate over UniValue arrays in tests
2017-02-10 00:53:09 +00:00
Jack Grigg
0d37ae3a59
Migrate Zcash-specific code to UniValue
2017-02-10 00:52:57 +00:00
Jonas Schnelli
f70084cf06
fix rpcmining/getblocktemplate univalue transition logic error
2017-02-10 00:35:24 +00:00
Jonas Schnelli
b60e9f230f
fix util_tests.cpp clang warnings
...
was introduced with #6121
2017-02-10 00:35:24 +00:00
Jonas Schnelli
6b1e42bbfa
univalue: add type check unit tests
2017-02-10 00:35:24 +00:00
Wladimir J. van der Laan
4bcb9c9099
univalue: add strict type checking
2017-02-10 00:35:24 +00:00
Wladimir J. van der Laan
5960d70002
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.
2017-02-10 00:35:24 +00:00
Wladimir J. van der Laan
ff67da37cd
Simplify RPCclient, adapt json_parse_error test
...
# Conflicts:
# src/test/rpc_tests.cpp
2017-02-10 00:35:24 +00:00
Jonas Schnelli
c288192b19
fix univalue json parse tests
2017-02-10 00:35:24 +00:00
Jonas Schnelli
b47f3aea36
fix missing univalue types during constructing
2017-02-10 00:35:24 +00:00
Jonas Schnelli
bf3f56025d
fix rpc batching univalue issue
2017-02-10 00:35:24 +00:00
Jonas Schnelli
d014114d67
Remove JSON Spirit wrapper, remove JSON Spirit leftovers
...
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
2017-02-10 00:35:24 +00:00
Jonas Schnelli
851f58f94e
remove JSON Spirit UniValue wrapper
2017-02-10 00:35:24 +00:00
Jonas Schnelli
565d26737a
fix rpc unit test, plain numbers are not JSON compatible object
...
UniValues read() does only read valid json.
2017-02-10 00:35:24 +00:00
Jonas Schnelli
9ccfdd9a01
univalue: correct bool support
2017-02-10 00:35:24 +00:00
Jonas Schnelli
49a5df0ef3
univalue: add support for real, fix percision and make it json_spirit compatible
...
- avoid breaking the API because of different number/percision handling
2017-02-10 00:35:24 +00:00
Jonas Schnelli
23f71dc740
special threatment for null,true,false because they are non valid json
2017-02-10 00:35:24 +00:00
Jonas Schnelli
38fc4b7090
expicit set UniValue type to avoid empty values
2017-02-10 00:35:24 +00:00
Jonas Schnelli
9756b7bd29
extend conversion to UniValue
2017-02-10 00:35:24 +00:00
Jeff Garzik
ed21d5bd4b
Convert tree to using univalue. Eliminate all json_spirit uses.
2017-02-10 00:35:24 +00:00
Jeff Garzik
03912600e8
UniValue: export NullUniValue global constant
2017-02-10 00:35:24 +00:00
Jeff Garzik
ec57cc0ffe
UniValue: prefer .size() to .count(), to harmonize w/ existing tree
2017-02-10 00:35:24 +00:00
zkbot
f52293b982
Auto merge of #2078 - ebfull:uaf, r=bitcartel
...
Fix use after free in transaction_tests.
Fixes #2026
2017-02-10 00:29:57 +00:00
Daira Hopwood
3df7c4c8c0
Address @str4d's comment about the case where -gen is not set.
...
Also avoid shadowing mineToLocalWallet variable.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-02-10 00:15:12 +00:00
zkbot
7d4ced95ed
Auto merge of #2056 - str4d:2035-experimental-mode, r=bitcartel
...
Add a flag for enabling experimental features
Closes #2035 .
2017-02-09 23:39:02 +00:00
Simon
6605125d4e
Add comment about fix for #2026 .
2017-02-09 15:17:21 -08:00
zkbot
d32511c72c
Auto merge of #2054 - str4d:2030-decoderawtransaction-joinsplit-fields, r=bitcartel
...
Show all JoinSplit components in getrawtransaction and decoderawtransaction
Closes #2030 .
2017-02-09 22:56:01 +00:00
Simon
91270dcfbc
Update test to check for more joinsplit related fields in getrawtransaction
2017-02-09 14:48:58 -08:00
Sean Bowe
69566ad756
Update libsnark.
2017-02-09 15:30:09 -07:00
Jack Grigg
b8eb37757b
Require -experimentalmode for wallet encryption
2017-02-09 22:10:58 +00:00
Jack Grigg
1f015f6afa
Add a flag for enabling experimental features
2017-02-09 22:10:58 +00:00
zkbot
263c62cb17
Auto merge of #2077 - ebfull:protover, r=bitcartel
...
Bump protocol version in release process if necessary.
Closes #2070 .
2017-02-09 22:06:27 +00:00
Sean Bowe
05ec7887f1
Fix use after free in transaction_tests.
2017-02-09 14:35:33 -07:00
Sean Bowe
0d317cd522
Bump protocol version in release process if necessary.
2017-02-09 14:25:20 -07:00
zkbot
0c78782662
Auto merge of #1965 - str4d:1955-single-address-mining, r=bitcartel
...
Switch miner to P2PKH, add -mineraddress option
Closes #945 and #1955 .
2017-02-09 20:58:00 +00:00
zkbot
253c610783
Auto merge of #2050 - str4d:2020-zmq, r=bitcartel
...
Add ZeroMQ notifications
Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#6103
- bitcoin/bitcoin#6684
- bitcoin/bitcoin#6686
- bitcoin/bitcoin#6736
- bitcoin/bitcoin#6739
- bitcoin/bitcoin#6743
- bitcoin/bitcoin#6768
- bitcoin/bitcoin#6779
- bitcoin/bitcoin#6810
- bitcoin/bitcoin#6927
- bitcoin/bitcoin#6980 (only upgrading zeromq)
- bitcoin/bitcoin#6680
- bitcoin/bitcoin#7058
- bitcoin/bitcoin#7621
- bitcoin/bitcoin#7335 (only parts affecting `zmq_test.py`)
- bitcoin/bitcoin#7853 (only parts affecting `zmq_test.py`)
- bitcoin/bitcoin#7762
- bitcoin/bitcoin#7993 (only upgrading zeromq)
- bitcoin/bitcoin#8238
- bitcoin/bitcoin#8701
- bitcoin/bitcoin#6685
Closes #2020 .
2017-02-09 20:08:15 +00:00
Daira Hopwood
9bba9b37c8
Better error reporting for the !ENABLE_WALLET && ENABLE_MINING case.
...
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-02-09 19:31:47 +00:00