Commit Graph

6320 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 4fac576c61
Merge pull request #6650
42cb388 Add chainstate obfuscation to avoid spurious antivirus detection (James O'Beirne)
2015-10-06 17:50:46 +02:00
Pavel Janík b2af29b806 Ignore bench_bitcoin binary. 2015-10-06 17:46:12 +02:00
James O'Beirne 42cb388167 Add chainstate obfuscation to avoid spurious antivirus detection
Adds an `obfuscate` parameter to `CLevelDBWrapper` and makes use of it
for all new chainstate stores built via `CCoinsViewDB`. Also adds an
`Xor` method to `CDataStream`.

Thanks to @sipa @laanwj @pstratem @dexX7 @KyrosKrane @gmaxwell.
2015-10-06 07:46:10 -07:00
Wladimir J. van der Laan b7d78fd0bd
Merge pull request #6733
7072c54 Support very-fast-running benchmarks (Gavin Andresen)
535ed92 Simple benchmarking framework (Gavin Andresen)
2015-10-06 16:34:23 +02:00
Wladimir J. van der Laan 3b2d37c619
Merge pull request #6742
58981d4 Changed logging to make -logtimestamps to work also for -printtoconsole (Arne Brutschy)
2015-10-06 09:59:19 +02:00
Gregory Maxwell b196b685c9 Test LowS in standardness, removes nuisance malleability vector.
This adds SCRIPT_VERIFY_LOW_S to STANDARD_SCRIPT_VERIFY_FLAGS which
 will make the node require the canonical 'low-s' encoding for
 ECDSA signatures when relaying or mining.

Consensus behavior is unchanged.

The rational is explained in a81cd96805ce6b65cca3a40ebbd3b2eb428abb7b:
 Absent this kind of test ECDSA is not a strong signature as given
 a valid signature {r, s} both that value and {r, -s mod n} are valid.
 These two encodings have different hashes allowing third parties a
 vector to change users txids.  These attacks are avoided by picking
 a particular form as canonical and rejecting the other form(s); in
 the of the LOW_S rule, the smaller of the two possible S values is
 used.

If widely deployed this change would eliminate the last remaining
 known vector for nuisance malleability on boring SIGHASH_ALL
 p2pkh transactions.  On the down-side it will block most
 transactions made by sufficiently out of date software.

Unlike the other avenues to change txids on boring transactions this
 one was randomly violated by all deployed bitcoin software prior to
 its discovery.  So, while other malleability vectors where made
 non-standard as soon as they were discovered, this one has remained
 permitted.  Even BIP62 did not propose applying this rule to
 old version transactions, but conforming implementations have become
 much more common since BIP62 was initially written.

Bitcoin Core has produced compatible signatures since a28fb70e in
 September 2013, but this didn't make it into a release until 0.9
 in March 2014; Bitcoinj has done so for a similar span of time.
 Bitcoinjs and electrum have been more recently updated.

This does not replace the need for BIP62 or similar, as miners can
 still cooperate to break transactions.  Nor does it replace the
 need for wallet software to handle malleability sanely[1]. This
 only eliminates the cheap and irritating DOS attack.

[1] On the Malleability of Bitcoin Transactions
Marcin Andrychowicz, Stefan Dziembowski, Daniel Malinowski, Łukasz Mazurek
http://fc15.ifca.ai/preproceedings/bitcoin/paper_9.pdf
2015-10-06 03:50:38 +00:00
Peter Todd da894ab5da Accept any sequence of PUSHDATAs in OP_RETURN outputs
Previously only one PUSHDATA was allowed, needlessly limiting
applications such as matching OP_RETURN contents with bloom filters that
operate on a per-PUSHDATA level. Now any combination that passes
IsPushOnly() is allowed, so long as the total size of the scriptPubKey
is less than 42 bytes. (unchanged modulo non-minimal PUSHDATA encodings)

Also, this fixes the odd bug where previously the PUSHDATA could be
replaced by any single opcode, even sigops consuming opcodes such as
CHECKMULTISIG. (20 sigops!)
2015-10-01 18:28:13 +02:00
Peter Todd 5d8709c3b7 Add IsPushOnly(const_iterator pc)
Allows IsPushOnly() to be applied to just part of the script for
OP_RETURN outputs.
2015-10-01 18:28:11 +02:00
Peter Todd 6a07eb676a Make TX_SCRIPTHASH clear vSolutionsRet first
Previously unlike other transaction types the TX_SCRIPTHASH would not
clear vSolutionsRet, which means that unlike other transaction types if
it was called twice in a row you would get the result of the previous
invocation as well.
2015-10-01 18:27:22 +02:00
Wladimir J. van der Laan f297042cae
Merge pull request #6637
95acf3c remove $(@F) and subdirs from univalue make (Jonas Schnelli)
9623e93 [Univalue] add univalue over subtree (Jonas Schnelli)
2f9f082 Squashed 'src/univalue/' content from commit 87d9045 (Jonas Schnelli)
0917306 remove univalue, prepare for subtree (Jonas Schnelli)
2015-10-01 16:36:15 +02:00
Jonas Schnelli 95acf3cc6d remove $(@F) and subdirs from univalue make 2015-10-01 14:28:44 +02:00
Wladimir J. van der Laan 4899a04c24
Merge pull request #5987
e761d7a Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) (Luke Dashjr)
2015-10-01 14:11:56 +02:00
Jeff Garzik cf9bb11f97
Merge pull request #6588 2015-10-01 05:58:51 -04:00
Wladimir J. van der Laan 12a7712abd
Merge pull request #5924
835c122 Clean up change computation in CreateTransaction. (Daniel Kraft)
2015-10-01 11:20:08 +02:00
Jonas Schnelli 9623e93473 [Univalue] add univalue over subtree
similar to secp256k1 include and compile univalue over a subtree
2015-10-01 10:49:57 +02:00
Jonas Schnelli 6e16a41313 Merge commit '2f9f082b5ef3c495c70598ef23383effef675f9a' as 'src/univalue' 2015-10-01 10:37:19 +02:00
Jonas Schnelli 0917306fdf remove univalue, prepare for subtree 2015-10-01 10:36:50 +02:00
Arne Brutschy 58981d4f7d Changed logging to make -logtimestamps to work also for -printtoconsole 2015-09-30 17:57:28 +02:00
Gavin Andresen 7072c544b5
Support very-fast-running benchmarks
Avoid calling gettimeofday every time through the benchmarking loop, by keeping
track of how long each loop takes and doubling the number of iterations done
between time checks when they take less than 1/16'th of the total elapsed time.
2015-09-30 09:24:42 -04:00
Gavin Andresen 535ed9223d
Simple benchmarking framework
Benchmarking framework, loosely based on google's micro-benchmarking
library (https://github.com/google/benchmark)

Wny not use the Google Benchmark framework? Because adding Even More Dependencies
isn't worth it. If we get a dozen or three benchmarks and need nanosecond-accurate
timings of threaded code then switching to the full-blown Google Benchmark library
should be considered.

The benchmark framework is hard-coded to run each benchmark for one wall-clock second,
and then spits out .csv-format timing information to stdout. It is left as an
exercise for later (or maybe never) to add command-line arguments to specify which
benchmark(s) to run, how long to run them for, how to format results, etc etc etc.
Again, see the Google Benchmark framework for where that might end up.

See src/bench/MilliSleep.cpp for a sanity-test benchmark that just benchmarks
'sleep 100 milliseconds.'

To compile and run benchmarks:
  cd src; make bench

Sample output:

Benchmark,count,min,max,average
Sleep100ms,10,0.101854,0.105059,0.103881
2015-09-30 09:24:42 -04:00
Wladimir J. van der Laan 4f44530bc3
Merge pull request #6680
d76a8ac use CBlockIndex* insted of uint256 for UpdatedBlockTip signal (Jonas Schnelli)
2015-09-30 11:08:30 +02:00
Wladimir J. van der Laan f6ce59cd3c
Merge pull request #6713
43edd51 SanitizeString: Allow hypen char (MarcoFalke)
2015-09-30 00:23:26 +02:00
Luke Dashjr e761d7a94f Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) 2015-09-29 19:46:34 +00:00
Wladimir J. van der Laan cb4d6d0569
Merge pull request #6730
a5b78c2 build: Remove dependency of bitcoin-cli on secp256k1 (Wladimir J. van der Laan)
2015-09-29 14:17:21 +02:00
Wladimir J. van der Laan a91eea6e3e
qt: periodic translations update 2015-09-29 13:36:33 +02:00
Wladimir J. van der Laan 2b0567b002
Merge pull request #6728
9fea833 timedata: Prevent warning overkill (Wladimir J. van der Laan)
2015-09-29 08:44:15 +02:00
Wladimir J. van der Laan ec908d5f7a http: Force-exit event loop after predefined time
This makes sure that the event loop eventually terminates, even if an
event (like an open timeout, or a hanging connection) happens to be
holding it up.
2015-09-28 15:06:20 +02:00
Wladimir J. van der Laan de9de2de36 http: Wait for worker threads to exit
Add a WaitExit() call to http's WorkQueue to make it delete the work
queue only when all worker threads stopped.

This fixes a problem that was reproducable by pressing Ctrl-C during
AppInit2:
```
/usr/include/boost/thread/pthread/condition_variable_fwd.hpp:81: boost::condition_variable::~condition_variable(): Assertion `!ret' failed.
/usr/include/boost/thread/pthread/mutex.hpp:108: boost::mutex::~mutex(): Assertion `!posix::pthread_mutex_destroy(&m)' failed.
```

I was assuming that `threadGroup->join_all();` would always have been
called when entering the Shutdown(). However this is not the case in
bitcoind's AppInit2-non-zero-exit case "was left out intentionally
here".
2015-09-28 15:06:20 +02:00
Wladimir J. van der Laan 5e0c221356 Make HTTP server shutdown more graceful
Shutting down the HTTP server currently breaks off all current requests.
This can create a race condition with RPC `stop` command, where the calling
process never receives confirmation.

This change removes the listening sockets on shutdown so that no new
requests can come in, but no longer breaks off requests in progress.

Meant to fix #6717.
2015-09-28 15:06:20 +02:00
Wladimir J. van der Laan a5b78c2fa8 build: Remove dependency of bitcoin-cli on secp256k1
bitcoin-cli (in contrast to bitcoin-tx, which does signing ops)
shouldn't need secp256k1, and indeed it doesn't.
2015-09-28 10:36:33 +02:00
Wladimir J. van der Laan 9fea833a12 timedata: Prevent warning overkill
The "please check your computer's data and time" message when the clock
deviates from the network currently generates an overkill of messages:

    orion@lethe:~/bitcoin$ src/bitcoind
    Warning: Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin Core will not work properly.

In the log:

    2015-09-27 16:24:13 *** Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin Core will not work properly.
    2015-09-27 16:24:13 Warning: Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin Core will not work properly.

Remove one level of 'Warning:' and reduce to one log message.
2015-09-27 16:40:16 +02:00
Wladimir J. van der Laan 48efbdbe98
Merge pull request #5264
af3208b Resolve issue 3166. These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts. This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa. (mruddy)
2015-09-25 19:19:07 +02:00
EthanHeilman 1534d9a83c Creates unittests for addrman, makes addrman testable.
Adds several unittests for addrman to verify it works as expected.
Makes small modifications to addrman to allow deterministic and targeted tests.
2015-09-24 15:20:48 -04:00
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 82d2aef7b3
Merge pull request #6715
60de0d5 Fix mempool package tracking edge case (Suhas Daftuar)
598b25d Add test showing bug in mempool packages (Suhas Daftuar)
2015-09-24 12:24:41 +02:00
Suhas Daftuar 60de0d5826 Fix mempool package tracking edge case
CalculateMemPoolAncestors was always looping over a transaction's inputs
to find in-mempool parents.  When adding a new transaction, this is the
correct behavior, but when removing a transaction, we want to use the
ancestor set that would be calculated by walking mapLinks (which should
in general be the same set, except during a reorg when the mempool is
in an inconsistent state, and the mapLinks-based calculation would be the
correct one).
2015-09-23 15:30:41 -04:00
Wladimir J. van der Laan 5b77244c60
Merge pull request #6550
3b33ec8 Avoid duplicate CheckBlock checks (Pieter Wuille)
391dff1 Do not store Merkle branches in the wallet. (Pieter Wuille)
2015-09-23 19:37:51 +02:00
Wladimir J. van der Laan e04b2fa9ba
Merge pull request #6653
4dee609 Rename rpcconsole.ui => debugwindow.ui (MarcoFalke)
0d0a2d6 [Qt] Raise debug window when requested (MarcoFalke)
2015-09-23 17:45:10 +02:00
Wladimir J. van der Laan 4dbd43ed0a
Merge pull request #6645
77c6072 Enable wallet key imports without rescan in pruned mode. (Gregory Maxwell)
2015-09-23 17:02:04 +02:00
Wladimir J. van der Laan 4939eabb75
Merge pull request #6688
131c23d Fix locking in GetTransaction. (Alex Morcos)
2015-09-23 16:53:40 +02:00
Wladimir J. van der Laan 999c8be81a
Merge pull request #6148
ae6f957 Enable block relay when pruning (Suhas Daftuar)
0da6ae2 Do not inv old or missing blocks when pruning (Suhas Daftuar)
2015-09-23 14:04:08 +02:00
MarcoFalke 43edd515e5 SanitizeString: Allow hypen char 2015-09-23 12:06:00 +02:00
Wladimir J. van der Laan 6264e5b378
Merge pull request #6646
6ecaec3 [Trivial] [logging] Rm extraneous cleansubver in serveral debug messages. (Gregory Maxwell)
2015-09-23 12:05:05 +02:00
MarcoFalke 4dee609e10 Rename rpcconsole.ui => debugwindow.ui 2015-09-23 10:27:39 +02:00
MarcoFalke 0d0a2d6bf9 [Qt] Raise debug window when requested
* Raise the debug window when hidden behind other windows
* Switch to the debug window when on another virtual desktop
* Show the debug window when minimized

This change is a conceptual copy of 5ffaaba and 382e9e2
2015-09-23 10:27:39 +02:00
Pieter Wuille 3b33ec85ed Avoid duplicate CheckBlock checks 2015-09-22 18:51:08 +02:00
Pieter Wuille 391dff16fe Do not store Merkle branches in the wallet.
Assume that when a wallet transaction has a valid block hash and transaction position
in it, the transaction is actually there. We're already trusting wallet data in a
much more fundamental way anyway.

To prevent backward compatibility issues, a new record is used for storing the
block locator in the wallet. Old wallets will see a wallet file synchronized up
to the genesis block, and rescan automatically.
2015-09-22 18:51:07 +02:00
Wladimir J. van der Laan e59d2a80f9
Merge pull request #6315
7aac6db [QT] dump banlist to disk in case of ban/unban over QT (Jonas Schnelli)
7f90ea7 [QA] adabt QT_NO_KEYWORDS for QT ban implementation (Jonas Schnelli)
07f70b2 [QA] fix netbase tests because of new CSubNet::ToString() output (Jonas Schnelli)
4ed0510 [Qt] call DumpBanlist() when baning unbaning nodes (Philip Kaufmann)
be89292 [Qt] reenabling hotkeys for ban context menu, use different words (Jonas Schnelli)
b1189cf [Qt] adapt QT ban option to banlist.dat changes (Jonas Schnelli)
65abe91 [Qt] add sorting for bantable (Philip Kaufmann)
51654de [Qt] bantable polish (Philip Kaufmann)
cdd72cd [Qt] simplify ban list signal handling (Philip Kaufmann)
43c1f5b [Qt] remove unused timer-code from banlistmodel.cpp (Jonas Schnelli)
e2b8028 net: Fix CIDR notation in ToString() (Wladimir J. van der Laan)
9e521c1 [Qt] polish ban table (Philip Kaufmann)
607809f net: use CIDR notation in CSubNet::ToString() (Jonas Schnelli)
53caec6 [Qt] bantable overhaul (Jonas Schnelli)
f0bcbc4 [Qt] bantable fix timestamp 64bit issue (Jonas Schnelli)
6135309 [Qt] banlist, UI optimizing and better signal handling (Jonas Schnelli)
770ca79 [Qt] add context menu with unban option to ban table (Jonas Schnelli)
5f42132 [Qt] add ui signal for banlist changes (Jonas Schnelli)
ad204df [Qt] add banlist table below peers table (Jonas Schnelli)
50f0908 [Qt] add ban functions to peers window (Jonas Schnelli)
2015-09-22 13:39:38 +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 d3b0d8c0e6
Merge pull request #6694
24cb7c7 [QT] fix thin space word wrap line brake issue (Jonas Schnelli)
2015-09-22 10:48:06 +02:00
Diego Viola 99ee4a656b Fix spelling of Qt 2015-09-22 05:00:10 -03:00
Wladimir J. van der Laan 10fc4fb368
Merge pull request #6668
9b1cdd7 [trivial] Remove obsolete pixmaps (MarcoFalke)
d1acf93 [qt] [trivial] share/qt/make_spinner.py => src/qt/res/movies/makespinner.sh (MarcoFalke)
2015-09-21 18:05:54 +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
Jonas Schnelli 7aac6db6eb [QT] dump banlist to disk in case of ban/unban over QT 2015-09-20 10:42:35 +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
Ashley Holman 34628a1807 TxMemPool: Change mapTx to a boost::multi_index_container
Indexes on:
- Tx Hash
- Fee Rate (fee-per-kb)
2015-09-19 13:22:40 -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
Jonas Schnelli 24cb7c7bbb [QT] fix thin space word wrap line brake issue
The thin space QT html hack results in cut-off chars/nums after a line break.

Avoid word wrap line breaks by using a smaller font and a line break before each alternative value)
2015-09-18 13:52:36 +02:00
Alex Morcos 131c23d027 Fix locking in GetTransaction.
GetTransaction needs to lock cs_main until ReadBlockFromDisk completes, the data inside CBlockIndex's can change since pruning.  This lock was held by all calls to GetTransaction except rest_tx.
2015-09-17 20:26:28 -04:00
Jonas Schnelli d76a8acb9b use CBlockIndex* insted of uint256 for UpdatedBlockTip signal
- removes mapBlockIndex find operation
- theoretically allows removing the cs_main lock during zqm notification while introducing a new file position lock
2015-09-16 16:51:21 +02:00
Jonas Schnelli 7f90ea78cb [QA] adabt QT_NO_KEYWORDS for QT ban implementation 2015-09-16 16:50:20 +02:00
Jonas Schnelli 07f70b2dde [QA] fix netbase tests because of new CSubNet::ToString() output 2015-09-16 16:50:20 +02:00
Philip Kaufmann 4ed05101f3 [Qt] call DumpBanlist() when baning unbaning nodes
- this matches RPC call behaviour
2015-09-16 16:50:20 +02:00
Jonas Schnelli be8929265f [Qt] reenabling hotkeys for ban context menu, use different words
- 1 (h)our
- 1 (d)ay
- 1 (w)eek
- 1 (y)ear
2015-09-16 16:50:20 +02:00
Jonas Schnelli b1189cfa10 [Qt] adapt QT ban option to banlist.dat changes 2015-09-16 16:50:20 +02:00
Philip Kaufmann 65abe91ce4 [Qt] add sorting for bantable 2015-09-16 16:50:19 +02:00
Philip Kaufmann 51654deff2 [Qt] bantable polish
- add missing NULL pointer checks
- add better comments and reorder some code in rpcconsole.cpp
- remove unneeded leftovers in bantable.cpp
- update bantable column sizes to prevent cutting of banned until
2015-09-16 16:50:19 +02:00
Philip Kaufmann cdd72cd5fb [Qt] simplify ban list signal handling
- remove banListChanged signal from client model
- directly call clientModel->getBanTableModel()->refresh() without the way
  over clientModel->updateBanlist()

- also fix clearing peer detail window, when selecting (clicking)
  peers in the ban list
2015-09-16 16:50:19 +02:00
Jonas Schnelli 43c1f5b8d7 [Qt] remove unused timer-code from banlistmodel.cpp 2015-09-16 16:50:19 +02:00
Wladimir J. van der Laan e2b8028e4c net: Fix CIDR notation in ToString()
Only use CIDR notation if the netmask can be represented as such.
2015-09-16 16:50:19 +02:00
Philip Kaufmann 9e521c1735 [Qt] polish ban table 2015-09-16 16:50:19 +02:00
Jonas Schnelli 607809f037 net: use CIDR notation in CSubNet::ToString() 2015-09-16 16:50:19 +02:00
Jonas Schnelli 53caec66cc [Qt] bantable overhaul
- some code cleanups
- fix date formatting
- reduce header includes
2015-09-16 16:50:19 +02:00
Jonas Schnelli f0bcbc4c8a [Qt] bantable fix timestamp 64bit issue 2015-09-16 16:50:19 +02:00
Jonas Schnelli 6135309816 [Qt] banlist, UI optimizing and better signal handling 2015-09-16 16:50:19 +02:00
Jonas Schnelli 770ca79aa0 [Qt] add context menu with unban option to ban table 2015-09-16 16:50:19 +02:00
Jonas Schnelli 5f42132950 [Qt] add ui signal for banlist changes 2015-09-16 16:50:19 +02:00
Jonas Schnelli ad204df1a9 [Qt] add banlist table below peers table 2015-09-16 16:50:19 +02:00
Jonas Schnelli 50f090884c [Qt] add ban functions to peers window
add ban option for peer context menu (1h, 24h, 7d, 1y).
2015-09-16 16:50:19 +02:00
Jeff Garzik ca5e2a1864
Merge pull request #6317 2015-09-16 09:40:53 -04: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
João Barbosa 5624e055b3 Add UpdatedBlockTip signal to CMainSignals and CValidationInterface 2015-09-16 10:59:32 +01:00
Jeff Garzik 6f55cddf6b
Merge pull request #5665 2015-09-15 12:30:32 -04:00
MarcoFalke d1acf938e6 [qt] [trivial] share/qt/make_spinner.py => src/qt/res/movies/makespinner.sh
* Merge make_spinner.py into makespinner.sh
* Also delete now unused imgs
* Actually use all 36 frames for the spinner animation
2015-09-13 17:57:12 +02:00
MarcoFalke 51ff777357 [trivial] Fix rpc message "help generate" 2015-09-12 18:19:53 +02:00
MarcoFalke 4c3cab14b7 [trivial] init cleanup 2015-09-12 13:28:00 +02:00
Gregory Maxwell 6ecaec395c [Trivial] [logging] Rm extraneous cleansubver in serveral debug messages.
We log the cleanSubVer as part of connect.  It is not uniquely more informative
 than any of the other data we have about a peer, often less.  It's also often
 long now as well.  There is no need to output it as part of mempoolrej,
 AcceptToMemoryPool, or pong entries.  Leaving it out makes our log entries
 more uniform and consistent.
2015-09-08 23:11:10 +00: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
Wladimir J. van der Laan 878ea69491
Merge pull request #6594
5ffaaba Disallow duplicate windows. (Casey Rodarmor)
2015-09-08 17:02:00 +02:00
Wladimir J. van der Laan 1d133d9573
Merge pull request #6640
eb3002b [TRIVIAL] Fix typo: exactmath -> exactmatch (paveljanik)
2015-09-08 16:43:26 +02:00
Wladimir J. van der Laan 6f6fb188b5
Merge pull request #6644
7a7e68d Prune the -prune help to reflect that the wallet is no longer disabled. (Gregory Maxwell)
2015-09-08 16:24:08 +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
Daniel Kraft 9cdc3353c5 Simplify logic of REST request suffix parsing.
This patch changes the way the suffix (giving the requested data format) is
parsed for REST requests.  Before, the string was split at '.'
characters and it was assumed that the second part was the suffix.

Now, we look for the last dot and use that to determine the suffix.
This allows for strings that contain dots (not used now, though), and
seems, in general, to be clearer and more intuitive.
2015-09-07 20:38:03 +02:00
Gregory Maxwell 77c6072473 Enable wallet key imports without rescan in pruned mode.
Complete rescan is incompatible with pruning, but rescan is optional on
 our wallet key import RPCs.  Import on use is very useful in some common
 situations in conjunction with pruning, e.g. merchant payment tracking.

This reenables importprivkey/importaddress/importpubkey when rescan
 is not used.

In the future we should consider changing the rescan argument to allow depth
 or date to allow limited rescanning when compatible with the retained
 block depth.
2015-09-07 01:28:32 +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
Casey Rodarmor 5ffaaba3a1 Disallow duplicate windows. 2015-09-04 15:25:42 -04:00
paveljanik eb3002bb71 [TRIVIAL] Fix typo: exactmath -> exactmatch
... but not yet in trivial tree
2015-09-04 19:22:48 +02:00
Wladimir J. van der Laan 93ff1b9041 net: correctly initialize nMinPingUsecTime
`nMinPingUsecTime` was left uninitialized in CNode.
The correct initialization for a minimum-until-now is int64_t's max value, so initialize it to that.
Thanks @MarcoFalke for noticing.
2015-09-04 16:27:38 +02:00
Wladimir J. van der Laan bbc2b39860
Merge pull request #6633
a6eb4ba Report minimum ping time in getpeerinfo (Matt Corallo)
2015-09-04 15:32:03 +02: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 4b437b227c
Merge pull request #6631
e83df07 Update RPC generate help for numblocks to include required (Ian T)
2015-09-04 10:45:27 +02:00
Matt Corallo a6eb4ba38b Report minimum ping time in getpeerinfo 2015-09-03 13:06:13 -07:00
Wladimir J. van der Laan 195942d58e
Merge pull request #6630
86270c8 Replace boost::reverse_lock with our own. (Casey Rodarmor)
2015-09-03 21:46:08 +02:00
Casey Rodarmor 86270c8164 Replace boost::reverse_lock with our own. 2015-09-03 15:13:40 -04:00
Ian T e83df075f9 Update RPC generate help for numblocks to include required
The `generate` RPC has no default `numblocks` and a numeric value is required.
2015-09-03 13:29:10 -04:00
Tom Harding 9524c4d35c In (strCommand == "tx"), return if AlreadyHave()
The main effect is to exit processing for recently-rejected hashes,
in case they are pushed to us without prior advertisement.  This
behavior was seen in the wild.

An additional effect is to do early checks for mempool or mapOrphan
existence.  No logging or nDoS tracking is needed for failures of
these checks.
2015-09-03 10:16:59 -07:00
Wladimir J. van der Laan 69dc5b51a0
Merge pull request #6374
027de94 Use network group instead of CNetAddr in final pass to select node to disconnect (Patrick Strateman)
000c18a Fix comment (Patrick Strateman)
fed3094 Acquire cs_vNodes before changing refrence counts (Patrick Strateman)
69ee1aa CNodeRef copy constructor and assignment operator (Patrick Strateman)
dc81dd0 Return false early if vEvictionCandidates is empty (Patrick Strateman)
17f3533 Better support for nodes with non-standard nMaxConnections (Patrick Strateman)
1317cd1 RAII wrapper for CNode* (Patrick Strateman)
df23937 Add comments to AttemptToEvictConnection (Patrick Strateman)
a8f6e45 Remove redundant whiteconnections option (Patrick Strateman)
b105ba3 Prefer to disconnect peers in favor of whitelisted peers (Patrick Strateman)
2c70153 AttemptToEvictConnection (Patrick Strateman)
4bac601 Record nMinPingUsecTime (Patrick Strateman)
ae037b7 Refactor: Move failure conditions to the top of AcceptConnection (Patrick Strateman)
1ef4817 Refactor: Bail early in AcceptConnection (Patrick Strateman)
541a1dd Refactor: AcceptConnection (Patrick Strateman)
2015-09-03 18:27:24 +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 be33f3f50b 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.
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
Cory Fields 6e996d39da tests: fix qt payment test
Now that boost no longer automatically initializes openssl, we have to
do it ourselves.
2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan 3140ef9249 build: build-system changes for libevent 2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan 6a21dd598c Remove rpc_boostasiotocnetaddr test
Dropping all use of boost::asio.
2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan af9305a7e8
Merge pull request #6583
9f3e48e add support for miniupnpc api version 14 (Pavel Vasin)
2015-08-31 17:38:07 +02:00
Patrick Strateman 027de94e1f
Use network group instead of CNetAddr in final pass to select node to disconnect 2015-08-30 22:09:14 -07:00
J Ross Nicoll 9bebf60698
Make sure LogPrint strings are line-terminated 2015-08-29 17:40:13 +01:00
Wladimir J. van der Laan ea19c2bc3f
Merge pull request #6530
c33c11e Improve addrman Select() performance when buckets are nearly empty (Pieter Wuille)
2015-08-26 17:58:40 +02:00
Pieter Wuille c33c11ebac Improve addrman Select() performance when buckets are nearly empty 2015-08-26 01:59:09 +02:00
Patrick Strateman 000c18aace Fix comment 2015-08-25 16:31:13 -07:00
Patrick Strateman fed30940ef Acquire cs_vNodes before changing refrence counts 2015-08-25 16:30:02 -07:00
Patrick Strateman 69ee1aab00 CNodeRef copy constructor and assignment operator 2015-08-25 15:33:29 -07:00
Cory Fields a19338723d net: Set SO_REUSEADDR for Windows too
When running the rpc tests in Wine, nodes often fail to listen on localhost
due to a stale socket from a previous run. This aligns the behavior with other
platforms.
2015-08-25 11:31:06 -04:00
Wladimir J. van der Laan da9beb288d
Merge pull request #6576
e938122 Stop parsing JSON after first finished construct. (Daniel Kraft)
2015-08-24 13:44:05 +02:00
Pavel Vasin 9f3e48e521 add support for miniupnpc api version 14
The value of new arg ttl is set to 2 as it's recommended default.
2015-08-23 23:53:49 +03:00
Patrick Strateman dc81dd02a1 Return false early if vEvictionCandidates is empty 2015-08-22 15:38:24 -07:00
Patrick Strateman 17f3533c84 Better support for nodes with non-standard nMaxConnections 2015-08-22 15:38:24 -07:00
Patrick Strateman 1317cd1928 RAII wrapper for CNode* 2015-08-22 15:38:24 -07:00
Patrick Strateman df23937422 Add comments to AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman a8f6e45249 Remove redundant whiteconnections option 2015-08-22 15:38:24 -07:00
Patrick Strateman b105ba398b Prefer to disconnect peers in favor of whitelisted peers 2015-08-22 15:38:24 -07:00
Patrick Strateman 2c701537c8 AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman 4bac601610 Record nMinPingUsecTime 2015-08-22 15:38:23 -07:00
Patrick Strateman ae037b707c Refactor: Move failure conditions to the top of AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 1ef4817614 Refactor: Bail early in AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 541a1dd9e6 Refactor: AcceptConnection 2015-08-22 15:38:23 -07:00
Wladimir J. van der Laan 49793fbb09
Merge pull request #6541
e0862c0 Reformat validateaddress help, add missing iswatchonly description. (Pavel Janík)
2015-08-21 12:35:20 +02:00
Wladimir J. van der Laan e3f13ddc54
Merge pull request #6242
17221bf chainparams: don't use std namespace (Cory Fields)
f0deec5 chainparams: move CCheckpointData into chainparams.h (Cory Fields)
2015-08-20 18:26:26 +02:00
Wladimir J. van der Laan e128464bc5
Merge pull request #6545
8be371d Do not store more than 200 timedata samples. (Pavel Janík)
2015-08-20 17:13:52 +02:00
Wladimir J. van der Laan 70ec975ea6
Merge pull request #6556
1123cdb add unit test for CNetAddr::GetGroup. (Alex Morcos)
bba3db1 Fix masking of irrelevant bits in address groups. (Alex Morcos)
2015-08-20 16:45:46 +02:00
Wladimir J. van der Laan 5e6e0898a1
Merge pull request #6571
1d1073c consensus: cache the openssl EC_GROUP to avoid a race condition for each CECKey instantiation (Cory Fields)
2015-08-20 16:33:50 +02:00
Daniel Kraft e938122b7b Stop parsing JSON after first finished construct.
Fix https://github.com/bitcoin/bitcoin/issues/6558.  In particular, stop
parsing JSON after the first object or array is finished.  Check that no
other garbage follows, and fail the parser if it does.
2015-08-20 12:48:43 +02:00
Alex Morcos 1123cdbf4d add unit test for CNetAddr::GetGroup. 2015-08-19 17:06:42 -04:00
Cory Fields 1d1073c2d3 consensus: cache the openssl EC_GROUP to avoid a race condition for each CECKey instantiation 2015-08-19 14:25:01 -04:00
Wladimir J. van der Laan ef30389e2a
Merge pull request #6544
c5c1edf Fix spelling mistake in -> if. (Mark Friedenbach)
e846b2a Correct a possibly intentional pun that is nevertheless hard to read: "two times of nLockTime." What is meant is that there are two kinds, or categories of nLockTime. (Mark Friedenbach)
2015-08-19 17:37:52 +02:00
Wladimir J. van der Laan 80cddbbba9
Merge pull request #6539
9f68ed6 typofixes (found by misspell_fixer) (Veres Lajos)
2015-08-19 17:28:00 +02:00