Commit Graph

961 Commits

Author SHA1 Message Date
jl777
b2c00e5434 Default txindex true 2017-05-23 11:53:04 +03:00
Jack Grigg
5b3bc9716e Implement automatic shutdown of deprecated Zcash versions
Closes #2274.
2017-05-12 14:41:46 +12:00
zkbot
f7f764e0b2 Auto merge of #2189 - bitcartel:1.0.7_with_apache_qpid, r=bitcartel
Add AMQP 1.0 support via Apache Qpid Proton C++ API 0.17.0

Closes #2188
2017-04-16 15:09:19 +00:00
jl777
945f015d80 Initial merge 2017-03-30 04:35:16 +03:00
Wladimir J. van der Laan
da1357e6cc Use real number of cores for default -par, ignore virtual cores
To determine the default for `-par`, the number of script verification
threads, use [boost::thread::physical_concurrency()](http://www.boost.org/doc/libs/1_58_0/doc/html/thread/thread_management.html#thread.thread_management.thread.physical_concurrency)
which counts only physical cores, not virtual cores.

Virtual cores are roughly a set of cached registers to avoid context
switches while threading, they cannot actually perform work, so spawning
a verification thread for them could even reduce efficiency and will put
undue load on the system.

Should fix issue #6358, as well as some other reported system overload
issues, especially on Intel processors.

The function was only introduced in boost 1.56, so provide a utility
function `GetNumCores` to fall back for older Boost versions.
2017-03-29 16:06:00 +13:00
Simon
99eb947a98 Add AMQP 1.0 support via Apache Qpid Proton C++ API 0.17.0 2017-03-25 08:51:40 -07:00
Patrick Strateman
a05be280e7 Remove vfReachable and modify IsReachable to only use vfLimited.
We do not know that a class of Network is reachable, only that it is not.
2017-03-25 20:25:45 +13:00
Daniel Cousens
65fd8eb134 torcontrol: only output disconnect if -debug=tor 2017-03-25 20:25:35 +13:00
Wladimir J. van der Laan
975dc649af torcontrol improvements and fixes
- Force AUTHCOOKIE size to be 32 bytes: This provides protection against
  an attack where a process pretends to be Tor and uses the cookie
  authentication method to nab arbitrary files such as the
  wallet
- torcontrol logging
- fix cookie auth
- add HASHEDPASSWORD auth, fix fd leak when fwrite() fails
- better error reporting when cookie file is not ok
- better init/shutdown flow
- stop advertizing service when disconnected from tor control port
- COOKIE->SAFECOOKIE auth
2017-03-25 20:22:12 +13:00
Wladimir J. van der Laan
eb5f63fe58 net: Automatically create hidden service, listen on Tor
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
API, to create and destroy 'ephemeral' hidden services programmatically.
https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service

This means that if Tor is running (and proper authorization is available),
bitcoin automatically creates a hidden service to listen on, without user
manual configuration. This will positively affect the number of available
.onion nodes.

- When the node is started, connect to Tor through control socket
- Send `ADD_ONION` command
- First time:
    - Make it create a hidden service key
    - Save the key in the data directory for later usage
- Make it redirect port 8333 to the local port 8333 (or whatever port we're listening on).
- Keep control socket connection open for as long node is running. The hidden service will
  (by default) automatically go away when the connection is closed.
2017-03-25 20:22:09 +13:00
Matt Quinn
8a5ae3c7a9 Consolidate individual references to the current maximum peer connection
value of 125 into a single constant declaration.
2017-03-25 20:22:07 +13:00
jl777
e0446653ba Test 2017-03-24 03:58:47 +02:00
jl777
b3df07a000 Test 2017-03-24 03:36:37 +02:00
jl777
a63e5f1256 Test 2017-03-24 03:32:04 +02:00
jl777
d8be8b2ef7 Test 2017-03-24 03:22:43 +02:00
jl777
5ead8b4e85 Test 2017-03-24 00:55:19 +02:00
jl777
a710762818 Test 2017-03-24 00:51:12 +02:00
jl777
ad0b9d6237 Test 2017-03-24 00:47:51 +02:00
Wladimir J. van der Laan
89bccddcd8 rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeout
The two timeouts for the server and client, are essentially different:

- In the case of the server it should be a lower value to avoid clients
clogging up connection slots

- In the case of the client it should be a high value to accomedate slow
  responses from the server, for example for slow queries or when the
  lock is contended

Split the options into `-rpcservertimeout` and `-rpcclienttimeout` with
respective defaults of 30 and 900.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
a659991a2c http: Disable libevent debug logging, if not explicitly enabled
Add a option "-debug=libevent" to enable libevent debugging for troubleshooting.
Libevent logging is redirected to our own log.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
7ed4d40c61 init: Ignore SIGPIPE
Ignore SIGPIPE on all non-win32 OSes, otherwise an unexpectedly disconnecting
RPC client will terminate the application. This problem was introduced
with the libhttp-based RPC server.

Fixes #6660.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
167b6231c9 Move windows socket init to utility function 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
116503c0b8 Fix race condition between starting HTTP server thread and setting EventBase()
Split StartHTTPServer into InitHTTPServer and StartHTTPServer to give
clients a window to register their handlers without race conditions.

Thanks @ajweiss for figuring this out.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
9fb5b94e64 Document options for new HTTP/RPC server in --help 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
jl777
8c82b6c5e0 Test 2017-03-18 20:47:38 +02:00
jl777
df35158ac2 Test 2017-03-18 19:13:14 +02:00
jl777
acad298339 Rewind < 0 2017-03-18 19:07:26 +02:00
jl777
6a877e46d5 Test 2017-03-18 12:23:35 +02:00
jl777
373e276894 Test 2017-03-18 10:46:45 +02:00
jl777
3938336c6c Test 2017-03-18 10:45:40 +02:00
jl777
9083591a37 Test 2017-03-18 10:34:00 +02:00
jl777
79cf331dd5 Test 2017-03-13 05:33:45 +02:00
jl777
5411346597 Test 2017-03-13 05:32:52 +02:00
Simon
07cf426404 Remove stale Qt comments and dead code 2017-03-09 17:04:59 -08:00
zkbot
dadb1ab74c Auto merge of #2101 - str4d:2074-tests, r=arcalinea
Bitcoin 0.12 test PRs 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6337
- bitcoin/bitcoin#6390
- bitcoin/bitcoin#5515
- bitcoin/bitcoin#6287 (partial, remainder included in bitcoin/bitcoin#6703)
- bitcoin/bitcoin#6465

Part of #2074.
2017-03-03 21:25:03 +00:00
Gavin Andresen
abb0e8cced Testing infrastructure: mocktime fixes
New, undocumented-on-purpose -mocktime=timestamp command-line
argument to startup with mocktime set. Needed because
time-related blockchain sanity checks are done on startup, before a
test has a chance to make a setmocktime RPC call.

And changed the setmocktime RPC call so calling it will not result in
currently connected peers being disconnected due to inactivity timeouts.
2017-03-03 11:46:59 -08:00
Adam Weiss
8550bcfeca Buffer log messages and explicitly open logs
Prevents stomping on debug logs in datadirs that are locked by other
instances and lost parameter interaction messages that can get wiped by
ShrinkDebugFile().

The log is now opened explicitly and all emitted messages are buffered
until this open occurs.  The version message and log cut have also been
moved to the earliest possible sensible location.
2017-03-03 10:57:23 -08:00
Wladimir J. van der Laan
8d9719e0ef Improve proxy initialization
Simplify and make the code in AppInit2 more clear.

This provides a straightforward flow, gets rid of .count() (which makes
it possible to override an earlier provided proxy option to nothing), as
well as comments the different cases.
2017-03-03 10:57:12 -08:00
Philip Kaufmann
fbbd3cc638 [init] add -blockversion help and extend -upnp help 2017-03-03 10:57:08 -08:00
Pieter Wuille
bfa832c7ed Reduce checkpoints' effect on consensus.
Instead of only checking height to decide whether to disable script checks,
actually check whether a block is an ancestor of a checkpoint, up to which
headers have been validated. This means that we don't have to prevent
accepting a side branch anymore - it will be safe, just less fast to
do.

We still need to prevent being fed a multitude of low-difficulty headers
filling up our memory. The mechanism for that is unchanged for now: once
a checkpoint is reached with headers, no headers chain branching off before
that point are allowed anymore.
2017-03-03 10:57:07 -08:00
Philip Kaufmann
db954a65ac use const references where appropriate 2017-03-03 10:57:05 -08:00
Jack Grigg
f42cde3c30 Remove reference to -reindex-chainstate
Revert this when bitcoin/bitcoin#7917 is merged.
2017-02-23 12:42:28 +00:00
Pieter Wuille
5d66d0a11e Do not ask a UI question from bitcoind 2017-02-23 12:40:45 +00:00
zkbot
93baaeee3e Auto merge of #2081 - daira:1955-single-address-mining, r=bitcartel
Address @str4d's comment on #1965 about the case where -gen is not set

https://github.com/zcash/zcash/pull/1965#discussion_r100414069

Note that the case of calling the ``setgenerate true`` RPC with the wallet disabled was already handled correctly.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-02-10 08:58:19 +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
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
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