Commit Graph

5790 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 4b4b9a8de6 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.
2015-06-06 09:30:41 +02:00
Wladimir J. van der Laan 12cdbabc26
Merge pull request #6152
08d9373 Remove unused code from wallet and validation interface (Michael Ford)
2015-06-05 21:24:15 +02:00
Wladimir J. van der Laan 3fce72eaa3
Merge pull request #6206
a9ac95c use const references where appropriate (Philip Kaufmann)
2015-06-05 07:11:44 +02:00
Jonas Schnelli ef5fca8b80 fix rpcmining/getblocktemplate univalue transition logic error 2015-06-04 21:40:11 +02:00
Philip Kaufmann a9ac95c1bc use const references where appropriate 2015-06-04 19:34:18 +02:00
Jonas Schnelli 44c7474446 univalue: add type check unit tests 2015-06-04 13:58:14 +02:00
Wladimir J. van der Laan c02309204b univalue: add strict type checking 2015-06-04 13:18:57 +02:00
Wladimir J. van der Laan 7e98a3c642 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.
2015-06-04 13:18:46 +02:00
Wladimir J. van der Laan 043df2b568 Simplify RPCclient, adapt json_parse_error test
# Conflicts:
#	src/test/rpc_tests.cpp
2015-06-04 13:18:35 +02:00
Jonas Schnelli 519eedeba7 fix univalue json parse tests 2015-06-04 10:35:36 +02:00
Jonas Schnelli c7fbbc7e1d fix missing univalue types during constructing 2015-06-04 09:16:21 +02:00
Jonas Schnelli 8f7e4abbe6 fix rpc batching univalue issue 2015-06-04 09:16:21 +02:00
Jonas Schnelli 9a8897f4ac 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
2015-06-04 09:16:21 +02:00
Jonas Schnelli 3df0411ad9 remove JSON Spirit UniValue wrapper 2015-06-04 09:16:06 +02:00
Jonas Schnelli 1f263c899e fix rpc unit test, plain numbers are not JSON compatible object
UniValues read() does only read valid json.
2015-06-04 09:16:06 +02:00
Jonas Schnelli e04d9c25cf univalue: correct bool support 2015-06-04 09:16:06 +02:00
Jonas Schnelli 0c5b2cf69a univalue: add support for real, fix percision and make it json_spirit compatible
- avoid breaking the API because of different number/percision handling
2015-06-04 09:16:06 +02:00
Jonas Schnelli 21c10de8c2 special threatment for null,true,false because they are non valid json 2015-06-04 09:16:06 +02:00
Jonas Schnelli 6c7bee0624 expicit set UniValue type to avoid empty values 2015-06-04 09:16:05 +02:00
Jonas Schnelli 53b4671a9d extend conversion to UniValue 2015-06-04 09:16:05 +02:00
Jeff Garzik 15982a8b69 Convert tree to using univalue. Eliminate all json_spirit uses. 2015-06-04 09:16:05 +02:00
Jeff Garzik 5e3060c0d1 UniValue: export NullUniValue global constant 2015-06-04 09:16:05 +02:00
Jeff Garzik efc7883772 UniValue: prefer .size() to .count(), to harmonize w/ existing tree 2015-06-04 09:16:05 +02:00
Wladimir J. van der Laan dbd8550231
Merge pull request #6220
d648236 bump version in clientversion.h (Philip Kaufmann)
2015-06-03 19:30:08 +02:00
Wladimir J. van der Laan 9d60602444
Merge pull request #5875
aa8c827 P2P regression test for new AcceptBlock behavior (Suhas Daftuar)
9be0e68 Be stricter in processing unrequested blocks (Suhas Daftuar)
2015-06-03 16:20:58 +02:00
Wladimir J. van der Laan 4e157fc60d json: fail read_string if string contains trailing garbage
Change `read_string` to fail when not the entire input has been
consumed. This avoids unexpected, even dangerous behavior (fixes #6223).

The new JSON parser adapted in #6121 also solves this problem so in
master this is a temporary fix, but should be backported to older releases.

Also adds tests for the new behavior.
2015-06-03 12:18:40 +02:00
Suhas Daftuar 9be0e6837b Be stricter in processing unrequested blocks
AcceptBlock will no longer process an unrequested block, unless it has not
been previously processed and has more work than chainActive.Tip()
2015-06-02 13:54:29 -04:00
Philip Kaufmann d648236d87 bump version in clientversion.h 2015-06-02 17:11:05 +02:00
Wladimir J. van der Laan f00b62391b
Merge pull request #6203
d449772 Remove P2SH coinbase flag, no longer interesting (Luke Dashjr)
2015-06-02 09:11:13 +02:00
Wladimir J. van der Laan 88a7ead5de
Merge pull request #6172
a1ba077 Ignore getheaders requests when not synced. (Suhas Daftuar)
2015-06-02 07:56:02 +02:00
Wladimir J. van der Laan 87550eefc1
Merge pull request #6183
28bf062 Fix off-by-one error w/ nLockTime in the wallet (Peter Todd)
2015-06-01 11:33:33 +02:00
Wladimir J. van der Laan 8d05ec7bda
Merge pull request #6164
aa41bc8 Update help message to match the #4219 change (lpescher)
f60bb5e Update documentation to match the #4219 change (lpescher)
cb87386 Make command line option to show all debugging consistent with similar options (lpescher)
2015-06-01 11:26:59 +02:00
Wladimir J. van der Laan 4f1677b6ba
Merge pull request #6198
0bb4385 Improve comment explaining purpose of MAX_MONEY constant (Peter Todd)
2015-06-01 11:25:59 +02:00
Wladimir J. van der Laan e9d0d252fc
Merge pull request #6208
d6922aa [net, trivial] remove using namespace std pollution in netbase.cpp (Philip Kaufmann)
49b2292 [net, trivial] explicitly use std::string for FindNode (Philip Kaufmann)
2015-06-01 09:53:45 +02:00
Wladimir J. van der Laan 42746b0476
Merge pull request #6193
6e71efa [REST] remove json input for getutxos, limit to query max. 15 outpoints (Jonas Schnelli)
64b8027 rest.cpp: strip whitespace (Jonas Schnelli)
2015-06-01 09:48:17 +02:00
Wladimir J. van der Laan 921ea89bc3
Merge pull request #6195
8273793 Eliminate compiler warning due to unused variable (Suhas Daftuar)
2015-06-01 08:49:47 +02:00
Philip Kaufmann d6922aad2c [net, trivial] remove using namespace std pollution in netbase.cpp 2015-05-31 15:48:23 +02:00
Philip Kaufmann 49b22928ee [net, trivial] explicitly use std::string for FindNode
- in OpenNetworkConnection we have a FindNode call, which gets a const
  char*, wheras we only have defined a FindNode for std::string
2015-05-31 15:44:22 +02:00
Luke Dashjr d449772cf6 Remove P2SH coinbase flag, no longer interesting 2015-05-31 06:53:48 +00:00
Peter Todd 0bb43854c7
Improve comment explaining purpose of MAX_MONEY constant 2015-05-27 21:02:04 -04:00
Jonas Schnelli 6e71efa9f0 [REST] remove json input for getutxos, limit to query max. 15 outpoints
Remove possibility to send json encoded parameters to `/rest/getutxos/` to avoid possible DoS scenarios.

The JSON output option is untouched.
2015-05-27 20:10:02 +02:00
Suhas Daftuar 8273793350 Eliminate compiler warning due to unused variable 2015-05-27 13:04:59 -04:00
Suhas Daftuar a1ba0778dd Ignore getheaders requests when not synced. 2015-05-27 10:36:04 -04:00
Jorge Timón e69734309c Chainparams: Explicit CMessageHeader::MessageStartChars to functions in main:
-UndoWriteToDisk
-WriteBlockToDisk
2015-05-27 16:01:07 +02:00
Wladimir J. van der Laan c7c9af381c
Merge pull request #5669
da29ecb Consensus: MOVEONLY: Move CValidationState from main consensus/validation (jtimon)
27afcd8 Consensus: Refactor: Decouple CValidationState from main::AbortNode() (Cory Fields)
2015-05-27 15:00:02 +02:00
Peter Todd 28bf06236d
Fix off-by-one error w/ nLockTime in the wallet
Previously due to an off-by-one error the wallet ignored
nLockTime-by-height transactions that would be valid in the next block
even though they are accepted into the mempool. The transactions
wouldn't show up until confirmed, nor would they be included in the
unconfirmed balance. Similar to the mempool behavior fix in 665bdd3b,
the wallet code was calling IsFinalTx() directly without taking into
account the fact that doing so tells you if the transaction could have
been mined in the *current* block, rather than the next block.

To fix this we strip IsFinalTx() of non-consensus-critical
functionality, removing the default arguments, and add CheckFinalTx() to
check if a transaction will be final in the next block.
2015-05-27 05:51:33 -04:00
Jonas Schnelli 64b8027c5c rest.cpp: strip whitespace 2015-05-27 09:41:14 +02:00
Wladimir J. van der Laan 0bcf04f046
Merge pull request #6153
8c35b6f Parameter interaction: disable upnp if -proxy set (Wladimir J. van der Laan)
2015-05-27 09:33:01 +02:00
Wladimir J. van der Laan 182686cdbd
Merge pull request #6186
b45c50c Fix two problems in CSubNet parsing (Wladimir J. van der Laan)
19e8d7b Simplify code for CSubnet (Wladimir J. van der Laan)
2015-05-27 09:08:39 +02:00
Wladimir J. van der Laan 165e323d85 qt: Periodic translation update 2015-05-26 14:36:47 +02:00