Commit Graph

209 Commits

Author SHA1 Message Date
Jonas Schnelli
ed3f13a057 [RPC] add setban/listbanned/clearbanned RPC commands 2017-03-02 13:23:03 -08:00
Alex van der Peet
94ee48c42a New RPC command disconnectnode 2017-03-02 13:23:03 -08:00
Wladimir J. van der Laan
2aee461930 univalue: Avoid unnecessary roundtrip through double for numbers
JSON makes no distinction between numbers and reals, and our code
doesn't need to do so either.

This removes VREAL, as well as its specific post-processing in
`UniValue::write`. Non-monetary amounts do not need to be forcibly
formatted with 8 decimals, so the extra roundtrip was unnecessary
(and potentially loses precision).

Zcash: cherry-picked from commit 7650449a6777710cf818d41862626164da0cd412
Dropped changes to qa/rpc-tests/rest.py pending addition of /rest/headers/
2017-02-10 02:19:01 +00:00
Wladimir J. van der Laan
d5bf1afae9 rpc: Make ValueFromAmount always return 8 decimals
This is the format that was always returned to JSON clients.
The difference was not noticed before, because VREAL values
are post-processed by univalue.

By implementing the functionality directly it breaks the dependency
of rpcserver on utilmoneystr. FormatMoney is now only used for debugging
purposes.

To test, port over the formatting tests from util_tests.cpp to
rpc_tests.cpp.
2017-02-10 02:18:59 +00:00
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
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
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
cc71666a51 unsigned int -> size_t for comparing with UniValue.size() 2017-02-10 00:53:13 +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
38fc4b7090 expicit set UniValue type to avoid empty values 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
Jack Grigg
8e8b6d701b Switch miner to P2PKH, add -mineraddress option
Closes #945 and #1955.
2017-02-06 11:54:58 +00:00
jl777
ad70a28f2f disable getchaintips 2017-02-03 09:36:35 +02:00
Jack Grigg
2cc0a252ad Add compile flag to disable compilation of mining code 2017-01-30 21:14:46 +01:00
jl777
3ced93646d Merge remote-tracking branch 'zcash/master' into dev
# Conflicts:
#	.gitignore
#	README.md
#	src/Makefile.gtest.include
#	src/gtest/test_checkblock.cpp
#	src/init.cpp
#	src/main.cpp
#	src/main.h
#	src/rpcserver.cpp
#	src/test/checkblock_tests.cpp
#	src/util.cpp
2017-01-25 09:26:28 +02:00
jl777
ab6e81ec8f test 2017-01-20 20:53:57 +02:00
jl777
d20fb2db48 test 2017-01-20 20:18:31 +02:00
zkbot
94f427a211 Auto merge of #1999 - str4d:1950-random-cookie-rpc-auth, r=ebfull
rpc: Implement random-cookie based authentication

Cherry-picked from bitcoin/bitcoin#6388.

Closes #1950.
2017-01-18 14:20:25 +00:00
Wladimir J. van der Laan
e957192c54 rpc: Implement random-cookie based authentication
When no `-rpcpassword` is specified, use a special 'cookie' file for
authentication. This file is generated with random content when the
daemon starts, and deleted when it exits. Read access to this file
controls who can access through RPC. By default this file is stored in
the data directory but it be overriden with `-rpccookiefile`.

This is similar to Tor CookieAuthentication: see
https://www.torproject.org/docs/tor-manual.html.en

Alternative to #6258. Like that pull, this allows running bitcoind
without any manual configuration. However, daemons should ideally never write to
their configuration files, so I prefer this solution.
2017-01-09 17:57:05 +01:00
Jack Grigg
f3e4968626 Only enable getblocktemplate when wallet is enabled 2016-12-16 10:44:04 +13:00
jl777
bc17ac4928 Merge remote-tracking branch 'zcash/master' into rebase
# Conflicts:
#	README.md
#	src/Makefile.gtest.include
#	src/chainparams.cpp
#	src/init.cpp
#	src/miner.cpp
#	src/wallet/wallet.cpp
2016-12-12 12:19:13 +02:00
jl777
dbaf115470 test 2016-11-23 13:03:06 -03:00
jl777
9bd3a9cddc test 2016-11-21 09:48:32 -03:00
Jack Grigg
000499ae64 Add getlocalsolps and getnetworksolps RPC calls, show them in getmininginfo 2016-11-16 22:02:49 +13:00
jl777
e80de3b274 test 2016-11-15 11:20:45 -03:00
jl777
ce906ce757 test 2016-11-15 11:17:55 -03:00
Simon
f4404d7b5b Closes #1680, temporary fix for rpc deadlock inherited from upstream. 2016-11-15 00:31:24 -08:00
jl777
2e500f5048 test 2016-11-14 15:00:25 -03:00
jl777
f1a1cd1914 test 2016-11-04 19:18:41 -03:00
jl777
597b9c2f9e test 2016-11-04 19:12:41 -03:00
jl777
da61ef214c boost round robin rate 2016-11-01 14:34:36 -03:00
Simon
4e16a7249c Closes #1746. Add rpc call z_validateaddress to validate zaddrs. 2016-10-31 20:05:48 -07:00
jl777
3bc31b8c78 test 2016-10-31 20:39:53 -03:00
jl777
336ab14177 test 2016-10-31 10:24:43 -03:00
jl777
30853e4ab9 Merge remote-tracking branch 'zcash/master' into dPoW 2016-10-28 13:50:21 -03:00
Sean Bowe
58c4c0bba3 Change some Bitcoin strings to Zcash strings. 2016-10-26 13:29:05 -06:00
jl777
c59a3beb29 test 2016-10-26 08:50:37 -03:00
jl777
4563911d3d test 2016-10-26 08:42:31 -03:00
jl777
d7d27bb347 test 2016-10-24 15:00:01 -03:00
jl777
83a7f513e8 test 2016-10-24 12:12:33 -03:00
jl777
de5678d8ed test 2016-10-23 14:51:43 -03:00
jl777
f3ae714c95 qt 2016-09-13 13:57:57 -03:00
jl777
5166804f02 komodo strings 2016-09-13 13:03:02 -03:00
Simon
6c41028f7c Add z_listreceivedbyaddress RPC call 2016-09-08 21:46:15 -07:00
Simon
6d2d045c6b Disable z_sendmany in safe mode 2016-09-08 21:46:15 -07:00
Simon
a0a3334c4d Add z_getbalance and z_gettotalbalance RPC calls to close #1201. 2016-09-08 21:46:14 -07:00
Simon
f86f625dce Update RPCServer to use AsyncRPCQueue's shared queue. 2016-09-08 21:46:14 -07:00