Commit Graph

175 Commits

Author SHA1 Message Date
Jonathan "Duke" Leto
589c42c1c1 Make help examples show komodo-cli 2018-03-03 16:51:58 -08:00
Jonathan "Duke" Leto
41572034cb Fix the port in curl examples shown at the bottom of all RPC method help texts 2018-03-03 16:49:58 -08:00
jl777
eea03b7b5d jumblr_pause and jumblr_resume
Thanks to @amigo for the feature request
2017-11-22 10:53:16 +04:00
jl777
5539178c7f Test 2017-07-12 12:26:38 +02:00
jl777
eeaaf55488 Jumblr 2017-07-12 12:15:20 +02:00
jl777
945f015d80 Initial merge 2017-03-30 04:35:16 +03:00
Bob McElrath
c922edd00f Add explicit shared_ptr constructor due to C++11 error 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
858afa1a4a Implement RPCTimerHandler for Qt RPC console
Implement RPCTimerHandler for Qt RPC console, so that `walletpassphrase`
works with GUI and `-server=0`.

Also simplify HTTPEvent-related code by using boost::function directly.

Zcash: QT changes ommitted
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
afd64f76ea evhttpd implementation
- *Replace usage of boost::asio with [libevent2](http://libevent.org/)*.
boost::asio is not part of C++11, so unlike other boost there is no
forwards-compatibility reason to stick with it. Together with #4738 (convert
json_spirit to UniValue), this rids Bitcoin Core of the worst offenders with
regard to compile-time slowness.

- *Replace spit-and-duct-tape http server with evhttp*. Front-end http handling
is handled by libevent, a work queue (with configurable depth and parallelism)
is used to handle application requests.

- *Wrap HTTP request in C++ class*; this makes the application code mostly
HTTP-server-neutral

- *Refactor RPC to move all http-specific code to a separate file*.
Theoreticaly this can allow building without HTTP server but with another RPC
backend, e.g. Qt's debug console (currently not implemented) or future RPC
mechanisms people may want to use.

- *HTTP dispatch mechanism*; services (e.g., RPC, REST) register which URL
paths they want to handle.

By using a proven, high-performance asynchronous networking library (also used
by Tor) and HTTP server, problems such as #5674, #5655, #344 should be avoided.

What works? bitcoind, bitcoin-cli, bitcoin-qt. Unit tests and RPC/REST tests
pass. The aim for now is everything but SSL support.

Configuration options:

- `-rpcthreads`: repurposed as "number of  work handler threads". Still
defaults to 4.

- `-rpcworkqueue`: maximum depth of work queue. When this is reached, new
requests will return a 500 Internal Error.

- `-rpctimeout`: inactivity time, in seconds, after which to disconnect a
client.

- `-debug=http`: low-level http activity logging
2017-03-24 09:03:59 +13:00
Jack Grigg
bec25c91cb Revert "Closes #1680, temporary fix for rpc deadlock inherited from upstream."
This reverts commit f4404d7b5b.
2017-03-24 09:03:59 +13:00
zkbot
a7cf698873 Auto merge of #2100 - str4d:2074-rpc, r=arcalinea
Bitcoin 0.12 RPC PRs 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6266
- bitcoin/bitcoin#6257
- bitcoin/bitcoin#6271
- bitcoin/bitcoin#6158
- bitcoin/bitcoin#6307
- bitcoin/bitcoin#6290
- bitcoin/bitcoin#6262
- bitcoin/bitcoin#6088
- bitcoin/bitcoin#6339
- bitcoin/bitcoin#6299 (partial, remainder in #2099)
- bitcoin/bitcoin#6350
- bitcoin/bitcoin#6247
- bitcoin/bitcoin#6362
- bitcoin/bitcoin#5486
- bitcoin/bitcoin#6417
- bitcoin/bitcoin#6398 (partial, remainder was included in #1950)
- bitcoin/bitcoin#6444
- bitcoin/bitcoin#6456 (partial, remainder was included in #2082)
- bitcoin/bitcoin#6380
- bitcoin/bitcoin#6970

Part of #2074.
2017-03-04 02:57:46 +00:00
Philip Kaufmann
db954a65ac use const references where appropriate 2017-03-03 10:57:05 -08:00
Wladimir J. van der Laan
84d1d5fd6f rpc: Accept strings in AmountFromValue
Accept strings containing decimal values, in addition to bare values.

Useful from JSON-RPC implementations where it's not possible to have
direct control over the text of numbers (e.g. where numbers are always
doubles), and it's still desired to send an exact value.

This would allow users to post JSON content with numbers encoded like
`{"value": "0.00000001"}` instead of `{"value": 0.00000001}` which some
php/python encoders wrap into 1e-8, or worse.
2017-03-02 13:26:34 -08:00
Forrest Voight
483672f772 When processing RPC commands during warmup phase, parse the
request object before returning an error so that id value can
be used in the response.

Prior to this commit, RPC commands sent during Bitcoin's
warmup/startup phase were responded to with a JSON-RPC error
with an id of null, which violated the JSON-RPC 2.0 spec:

id: This member is REQUIRED. It MUST be the same as the value
of the id member in the Request Object. If there was an error
in detecting the id in the Request object (e.g. Parse
error/Invalid Request), it MUST be Null.
2017-03-02 13:23:03 -08:00
Peter Todd
d3d5483eef Add getblockheader RPC call
Alternative to getblock that works even when the block itself has been
pruned, returning all available information.
2017-03-02 13:23:03 -08:00
Matt Corallo
3d8013a01b Add fundrawtransaction RPC method 2017-03-02 13:23:03 -08:00
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