Commit Graph

677 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 34dc03d8e0
Merge pull request #6664
51ff777 [trivial] Fix rpc message "help generate" (MarcoFalke)
4c3cab1 [trivial] init cleanup (MarcoFalke)
2015-09-24 18:21:18 +02:00
Wladimir J. van der Laan a3babc826d
Merge pull request #6647
1c1b1b3 [uacomment] Sanitize per BIP-0014 (MarcoFalke)
2015-09-22 11:36:50 +02:00
Wladimir J. van der Laan 5e21388c48
Merge pull request #6695
ddf98d1 Make RPC tests cope with server-side timeout between requests (Wladimir J. van der Laan)
2190ea6 rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeout (Wladimir J. van der Laan)
8b2d6ed http: Disable libevent debug logging, if not explicitly enabled (Wladimir J. van der Laan)
5ce43da init: Ignore SIGPIPE (Wladimir J. van der Laan)
2015-09-21 17:16:40 +02:00
Wladimir J. van der Laan 2190ea6c4e 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.
2015-09-21 17:15:36 +02:00
Wladimir J. van der Laan 8b2d6edaa9 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.
2015-09-21 13:24:34 +02:00
Suhas Daftuar 5add7a74a6 Track transaction packages in CTxMemPoolEntry
Associate with each CTxMemPoolEntry all the size/fees of descendant
mempool transactions.  Sort mempool by max(feerate of entry, feerate
of descendants).  Update statistics on-the-fly as transactions enter
or leave the mempool.

Also add ancestor and descendant limiting, so that transactions can
be rejected if the number or size of unconfirmed ancestors exceeds
a target, or if adding a transaction would cause some other mempool
entry to have too many (or too large) a set of unconfirmed in-
mempool descendants.
2015-09-19 13:25:48 -04:00
Wladimir J. van der Laan 5ce43da03d 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.
2015-09-18 15:38:52 +02:00
MarcoFalke 1c1b1b315f [uacomment] Sanitize per BIP-0014
* SanitizeString() can be requested to be more strict
* Throw error when SanitizeString() changes uacomments
* Fix tests
2015-09-16 15:23:29 +02:00
Jeff Garzik e6a14b64d6 Add ZeroMQ support. Notify blocks and transactions via ZeroMQ
Continues Johnathan Corgan's work.
Publishing multipart messages

Bugfix: Add missing zmq header includes

Bugfix: Adjust build system to link ZeroMQ code for Qt binaries
2015-09-16 11:01:35 +01:00
MarcoFalke 4c3cab14b7 [trivial] init cleanup 2015-09-12 13:28:00 +02:00
Wladimir J. van der Laan 0c27795140
Merge pull request #6579
afb0cca Add NODE_BLOOM service bit and bump protocol version (Matt Corallo)
2015-09-08 17:10:36 +02:00
Gregory Maxwell 7a7e68d1e2 Prune the -prune help to reflect that the wallet is no longer disabled.
The wallet hasn't been disabled since 3201035f22.
2015-09-07 18:49:12 +00:00
Matt Corallo afb0ccaf9c Add NODE_BLOOM service bit and bump protocol version
Lets nodes advertise that they offer bloom filter support explicitly.
The protocol version bump allows SPV nodes to assume that NODE_BLOOM is
set if NODE_NETWORK is set for pre-70011 nodes.

Also adds an option to turn bloom filter support off for nodes which
advertise a version number >= 70011. Nodes attempting to use bloom
filters on such protocol versions are banned, and a later upgade
should drop nodes of an older version which attempt to use bloom
filters.

Much code stolen from Peter Todd.

Implements BIP 111
2015-09-05 23:29:13 -07:00
Wladimir J. van der Laan 9aa90994ee
Merge pull request #5677
d528025 Revert "rpc-tests: re-enable rpc-tests for Windows" (Wladimir J. van der Laan)
1e700c9 doc: update deps in build-unix.md after libevent (Wladimir J. van der Laan)
26c9b83 Move windows socket init to utility function (Wladimir J. van der Laan)
4be0b08 libevent: Windows reuseaddr workaround in depends (Cory Fields)
3a174cd Fix race condition between starting HTTP server thread and setting EventBase() (Wladimir J. van der Laan)
6d2bc22 Document options for new HTTP/RPC server in --help (Wladimir J. van der Laan)
be33f3f Implement RPCTimerHandler for Qt RPC console (Wladimir J. van der Laan)
57d85d9 doc: mention SSL support dropped for RPC in release notes (Wladimir J. van der Laan)
40b556d evhttpd implementation (Wladimir J. van der Laan)
ee2a42b tests: GET requests cannot have request body, use POST in rest.py (Wladimir J. van der Laan)
6e996d3 tests: fix qt payment test (Cory Fields)
3140ef9 build: build-system changes for libevent (Wladimir J. van der Laan)
a9af234 libevent: add depends (Cory Fields)
6a21dd5 Remove rpc_boostasiotocnetaddr test (Wladimir J. van der Laan)
8f9301c qa: Remove -rpckeepalive tests from httpbasics (Wladimir J. van der Laan)
51fcfc0 doc: remove documentation for rpcssl (Wladimir J. van der Laan)
2015-09-04 13:06:32 +02:00
Wladimir J. van der Laan 26c9b83677 Move windows socket init to utility function 2015-09-03 10:59:19 +02:00
Wladimir J. van der Laan 3a174cd400 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.
2015-09-03 10:59:19 +02:00
Wladimir J. van der Laan 6d2bc22146 Document options for new HTTP/RPC server in --help 2015-09-03 10:59:19 +02:00
Wladimir J. van der Laan 40b556d374 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
2015-09-03 10:59:18 +02:00
Patrick Strateman a8f6e45249 Remove redundant whiteconnections option 2015-08-22 15:38:24 -07:00
Wladimir J. van der Laan 7f1f8f5edf Move mempool rejections to new debug category
Move mempool rejections to debug category `mempoolrej`, to make it possible
to show them without enabling the entire category `mempool` which is
high volume.
2015-08-11 17:29:34 +02:00
Wladimir J. van der Laan c384800027
Merge pull request #6462
7b79cbd limit total length of user agent comments (Pavol Rusnak)
557f8ea implement uacomment config parameter which can add comments to user agent as per BIP-0014 (Pavol Rusnak)
2015-08-05 15:43:10 +02:00
Wladimir J. van der Laan c9c017adf6
Merge pull request #6489
f261f19 Give a better error message if system clock is bad (Casey Rodarmor)
2015-08-05 10:23:01 +02:00
Pavol Rusnak 7b79cbd722 limit total length of user agent comments
Reworked-By: Wladimir J. van der Laan <laanwj@gmail.com>
2015-08-05 09:38:20 +02:00
Pieter Wuille 586a29253d
Merge pull request #6503
19dd40a Consolidate individual references to the current maximum peer connection value of 125 into a single constant declaration. (Matt Quinn)
2015-08-04 19:43:30 +02:00
Wladimir J. van der Laan b6fee6b7c7
Merge pull request #6504
9ca7857 Rationalize currency unit to "BTC" (Ross Nicoll)
2015-08-04 01:24:19 +02:00
Ross Nicoll 9ca7857df7 Rationalize currency unit to "BTC"
Previously various user-facing strings have used inconsistent currency units "BTC",
"btc" and "bitcoins". This adds a single constant and uses it for each reference to
the currency unit.

Also adds a description of the unit for --maxtxfee, and adds the missing "amount"
field description to the (deprecated) move RPC command.
2015-08-03 22:58:30 +01:00
Matt Quinn 19dd40a25f Consolidate individual references to the current maximum peer connection
value of 125 into a single constant declaration.
2015-08-03 14:37:00 -07:00
Casey Rodarmor f261f19b4b Give a better error message if system clock is bad
Fixes #2007

This checks to see if the system clock appears to be bad and gives a
helpful error message. If the user's clock is set incorrectly, hopefully
they'll abort, fix it, and then save themselves a fruitless resync.
2015-08-03 15:11:52 -04:00
Wladimir J. van der Laan 9e6c33b202
Merge pull request #6356
f0cba6f Delay initial pruning until after wallet init (Adam Weiss)
2015-08-03 19:34:50 +02:00
Wladimir J. van der Laan eec7757445 qt: Introduce PlatformStyle
Introduce a PlatformStyle to handle platform-specific customization of
the UI.

This replaces 'scicon', as well as #ifdefs to determine whether to place
icons on buttons.

The selected PlatformStyle defaults to the platform that the application
was compiled on, but can be overridden from the command line with
`-uiplatform=<x>`.

Also fixes the warning from #6328.
2015-07-31 09:35:18 +02:00
Adam Weiss f0cba6f8eb Delay initial pruning until after wallet init
Don't prune until any wallet rescanning has taken place to avoid
potentially pruning blocks that the wallet rescan may need.
2015-07-29 14:00:25 -04:00
Wladimir J. van der Laan ca37e0f339
Merge pull request #5697
60c8bac Includes: Cleanup around net main and wallet (Jorge Timón)
9dd793f TRIVIAL: Missing includes (Jorge Timón)
2015-07-27 14:40:29 +02:00
Jorge Timón 9dd793f499 TRIVIAL: Missing includes 2015-07-23 21:10:22 +02:00
Wladimir J. van der Laan 633fe10869
Merge pull request #6149
27d7605 Buffer log messages and explicitly open logs (Adam Weiss)
2015-07-22 18:24:20 +02:00
Wladimir J. van der Laan 445220544e
Merge pull request #5288
e3cae52 Added -whiteconnections=<n> option (Josh Lehan)
2015-07-10 15:07:15 +02:00
Adam Weiss 27d7605804 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.
2015-07-06 21:54:31 -04:00
Wladimir J. van der Laan 9546a977d3
Merge pull request #6335
9238ecb Policy: MOVEONLY: 3 functions to policy.o: (Luke Dashjr)
627b9de Policy: MOVEONLY: Create policy/policy.h with some constants (Jorge Timón)
2015-07-06 18:54:20 +02:00
Wladimir J. van der Laan d0a10c1959
Merge pull request #6329
0c37634 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only (Luke Dashjr)
2015-07-03 14:00:06 +02:00
Luke Dashjr 0c376340a4 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only 2015-07-03 08:29:16 +00:00
Wladimir J. van der Laan d7ada03b8a
Merge pull request #6361
4716267 Use real number of cores for default -par, ignore virtual cores (Wladimir J. van der Laan)
2015-07-02 20:01:04 +02:00
Wladimir J. van der Laan 47162673c7 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:🧵: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.
2015-07-01 18:01:16 +02:00
Jonas Schnelli d0fc10a844 detach wallet from miner 2015-06-30 21:45:46 +02:00
Jorge Timón 627b9deff4 Policy: MOVEONLY: Create policy/policy.h with some constants 2015-06-26 17:59:07 +02:00
Gavin Andresen 6a4b97e863
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.
2015-06-24 15:18:55 -04:00
Wladimir J. van der Laan 40400d53d3
Merge pull request #6272
edbdf88 tests: Extend RPC proxy tests (Wladimir J. van der Laan)
baf0507 Improve proxy initialization (Wladimir J. van der Laan)
2015-06-18 17:53:36 +02:00
Wladimir J. van der Laan c1fb0e1075
Merge pull request #6274
02a6702 Add option `-alerts` to opt out of alert system (Wladimir J. van der Laan)
2015-06-15 09:57:33 +02:00
Wladimir J. van der Laan 02a6702a82 Add option `-alerts` to opt out of alert system
Make it possible to opt-out of the centralized alert system by providing
an option `-noalerts` or `-alerts=0`. The default remains unchanged.

This is a gentler form of #6260, in which I went a bit overboard by
removing the alert system completely.

I intend to add this to the GUI options in another pull after this.
2015-06-15 09:53:33 +02:00
Josh Lehan e3cae52538 Added -whiteconnections=<n> option
This sets aside a number of connection slots for whitelisted peers,
useful for ensuring your local users and miners can always get in,
even if your limit on inbound connections has already been reached.
2015-06-14 02:07:15 -07:00
Wladimir J. van der Laan 8ccc07c077
Merge pull request #6256
65b9454 Use best header chain timestamps to detect partitioning (Gavin Andresen)
2015-06-12 16:44:36 +02:00
Wladimir J. van der Laan baf05075fa 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.
2015-06-12 12:41:44 +02:00