Commit graph

6910 commits

Author SHA1 Message Date
Jonas Schnelli 411b05ac95
Refactor parameter interaction, call it before AppInit2() 2015-11-27 13:26:00 +01:00
Wladimir J. van der Laan 0e935865b9
Merge pull request #6871
63b5840 Fix usage of local python-bitcoinlib (Peter Todd)
16a2f93 Fix incorrect locking of mempool during RBF replacement (Peter Todd)
97203f5 Port test to rpc-test framework (Suhas Daftuar)
20367d8 Add test for max replacement limit (Suhas Daftuar)
73d9040 Improve RBF replacement criteria (Suhas Daftuar)
b272ecf Reject replacements that add new unconfirmed inputs (Peter Todd)
fc8c19a Prevent low feerate txs from (directly) replacing high feerate txs (Peter Todd)
0137e6f Add tests for transaction replacement (Peter Todd)
5891f87 Add opt-in full-RBF to mempool (Peter Todd)
2015-11-27 13:20:39 +01:00
Wladimir J. van der Laan e92377fa7f
Merge pull request #6134
e304432 Pass reference to estimateSmartFee and cleanup whitespace (Suhas Daftuar)
56106a3 Expose RPC calls for estimatesmart functions (Alex Morcos)
e93a236 add estimateSmartFee to the unit test (Alex Morcos)
6303051 EstimateSmart functions consider mempool min fee (Alex Morcos)
f22ac4a Increase success threshold for fee estimation to 95% (Alex Morcos)
4fe2823 Change wallet and GUI code to use new smart fee estimation calls. (Alex Morcos)
22eca7d Add smart fee estimation functions (Alex Morcos)
2015-11-27 12:59:37 +01:00
Wladimir J. van der Laan 05d591839f
Merge pull request #5967
072e2f8 Alter assumptions in CCoinsViewCache::BatchWrite (Alex Morcos)
2015-11-27 12:44:00 +01:00
Wladimir J. van der Laan 9a3e1a59df
Merge pull request #7058
ffacd27 zmq: prepend zmq to debug messages (Daniel Cousens)
14075b1 init: add zmq to debug categories (Daniel Cousens)
cdcd816 init: amend ZMQ flag names (Daniel Cousens)
2015-11-27 10:12:43 +01:00
Pieter Wuille a9f3d3db5c Fix and improve relay from whitelisted peers
This makes sure that retransmits by a whitelisted peer also actually
result in a retransmit.

Further, this changes the logic to never relay in case we would assign
a DoS score, as we expect to get DoS banned ourselves as a result.
2015-11-26 23:44:57 +01:00
Wladimir J. van der Laan f8a8e27a6a
Merge pull request #7069
fa472f3 [trivial] Fix -maxmempool InitError (MarcoFalke)
2015-11-26 11:18:31 +01:00
Peter Todd cde857f2d9
Connect to Tor hidden services by default
Adds 127.0.0.1:9050 for the .onion proxy if we can succesfully connect
to the control port.

Natural followup to creating hidden services automatically.
2015-11-26 05:14:31 -05:00
Wladimir J. van der Laan be281d8a83
Merge pull request #7087
9cf6688 Document both the peerbloomfilters and enforcenodebloom options. (Patick Strateman)
0f4dc53 Add enforcenodebloom option. (Patick Strateman)
b3caa9b Move bloom filter filtering logic outside of command "switch" (giant if/else). (Patick Strateman)
2015-11-26 08:43:21 +01:00
Wladimir J. van der Laan 4ec3561eb3 Replace scriptnum_test's normative ScriptNum implementation
Compare against the scriptnum from Bitcoin Core 0.10 instead of OpenSSL.
Closes #7086.
2015-11-25 13:59:49 +01:00
Wladimir J. van der Laan 2b2ddc558e
Merge pull request #7088
5ad5463 Squashed 'src/secp256k1/' changes from 2bfb82b..6c527ec (MarcoFalke)
2015-11-25 11:31:59 +01:00
daniel c434940e83 uint256::GetCheapHash bigendian compatibility 2015-11-25 16:19:24 +08:00
Jonas Schnelli 26af1ac7cb
Merge pull request #7006
f71bfef add UI help for -resetguisettings (Jonas Schnelli)
ae98388 [Qt] add startup option to reset Qt settings (Jonas Schnelli)
2015-11-25 09:05:19 +01:00
Patick Strateman 1bb289fe1b Assert now > 0 in GetTime GetTimeMillis GetTimeMicros
Previously all of these functions could return negative values (for different
readons).  Large portions of the codebase currently assume that these
functions return positive values.
2015-11-24 18:39:19 -08:00
Wladimir J. van der Laan b19fe277dd
Merge pull request #7075
4846543 Move time data log print to 'net' category to reduce log noise (tulip)
2015-11-24 16:02:02 +01:00
Suhas Daftuar e30443244a Pass reference to estimateSmartFee and cleanup whitespace 2015-11-24 08:53:14 -05:00
MarcoFalke fa472f330f [trivial] Fix -maxmempool InitError 2015-11-24 12:40:59 +01:00
Patick Strateman 9cf668844e Document both the peerbloomfilters and enforcenodebloom options. 2015-11-24 02:08:00 -08:00
Patick Strateman 0f4dc53fd6 Add enforcenodebloom option.
Previously peers which implement a protocol version less than NO_BLOOM_VERSION
would not be disconnected for sending a filter command, regardless of the
peerbloomfilter option.

Many node operators do not wish to provide expensive bloom filtering for SPV
clients, previously they had to cherry pick the commit which enabled the
disconnect logic.

The default should remain false until a sufficient percent of SPV clients
have updated.
2015-11-24 02:08:00 -08:00
Wladimir J. van der Laan 02a0f348c2
Merge pull request #7066
5c2fd38 Add missing "blocktime" description to listtransactions help, fix formatting. (Pavel Janík)
2015-11-24 10:55:36 +01:00
Patick Strateman b3caa9b7fa Move bloom filter filtering logic outside of command "switch" (giant if/else).
Moving this logic outside of the "switch" makes it far simpler to
enable the forced disconnect by a parameter.
2015-11-24 01:50:53 -08:00
Wladimir J. van der Laan 72dccfc29d
Merge pull request #7045
2aa49ce Bugfix: Use unique autostart filenames on Linux for testnet/regtest (Luke Dashjr)
2015-11-24 09:51:02 +01:00
MarcoFalke fa63e49b35 Merge commit '5ad54630935d1f340666de7bc9ffef9b8a1df296' into HEAD 2015-11-24 09:22:18 +01:00
MarcoFalke faf12bc283 OpenSSL 1.1.0: Fix text variant of the version number 2015-11-24 09:07:26 +01:00
Wladimir J. van der Laan f91e29fd4d
Merge pull request #7065
3522f49 http: add Boost 1.49 compatibility (Wladimir J. van der Laan)
2015-11-24 08:42:29 +01:00
Jorge Timón 2e29e7e247 Globals: Remove a bunch of Params() calls from main.cpp:
1) Chainparams: Explicit CChainParams arg for main:

-AcceptBlock
-AcceptBlockHeader
-ActivateBestChain
-ConnectTip
-InitBlockIndex
-LoadExternalBlockFile
-VerifyDB parametric constructor

2) Also pickup more Params()\. in main.cpp

3) Pass nPruneAfterHeight explicitly to new FindFilesToPrune() in main.cpp
2015-11-23 12:14:40 +01:00
Gregory Maxwell ebb25f4c23 Limit setAskFor and retire requested entries only when a getdata returns.
The setAskFor duplicate elimination was too eager and removed entries
 when we still had no getdata response, allowing the peer to keep
 INVing and not responding.
2015-11-23 01:54:23 +00:00
kazcw 5029698186 prevent peer flooding request queue for an inv
mapAlreadyAskedFor does not keep track of which peer has a request queued for a
particular tx. As a result, a peer can blind a node to a tx indefinitely by
sending many invs for the same tx, and then never replying to getdatas for it.
Each inv received will be placed 2 minutes farther back in mapAlreadyAskedFor,
so a short message containing 10 invs would render that tx unavailable for 20
minutes.

This is fixed by disallowing a peer from having more than one entry for a
particular inv in mapAlreadyAskedFor at a time.
2015-11-23 01:18:54 +00:00
Gregory Maxwell c322652b71
Merge pull request #7046
80ae230 Improve log messages for blocks only violations. (Patick Strateman)
08843ed Add relaytxes status to getpeerinfo (Peter Todd)
d8aaa51 Bail early in processing transactions in blocks only mode. (Patick Strateman)
3587f6a Fix relay mechanism for whitelisted peers under blocks only mode. (Patick Strateman)
2015-11-22 14:01:33 -08:00
tulip 4846543ac5 Move time data log print to 'net' category to reduce log noise 2015-11-22 06:48:25 +00:00
Patick Strateman 80ae230a52 Improve log messages for blocks only violations. 2015-11-21 16:09:52 -08:00
Gregory Maxwell 31de2414c6
Merge pull request #7011
6531f17 Add mediantime field to getblock and getblockheader (Peter Todd)
7259769 Document new mediantime field in getblockchaininfo (Peter Todd)
c277a63 Clarify nLockTime-by-time comment in CheckFinalTx() (Peter Todd)
748321e Add mediantime field to getblockchaininfo RPC call (Peter Todd)
2015-11-21 14:00:55 -08:00
Gregory Maxwell 616d61b20d
Merge pull request #6851
3e7c891 Optimisation: Store transaction list order in memory rather than compute it every need (Luke Dashjr)
2015-11-20 18:52:44 -08:00
Luke Dashjr 3e7c89196c Optimisation: Store transaction list order in memory rather than compute it every need
Huge performance improvement (450%) for zapwallettxes
2015-11-21 01:48:25 +00:00
Peter Todd 08843ed998 Add relaytxes status to getpeerinfo 2015-11-20 16:07:12 -08:00
Patick Strateman d8aaa51bec Bail early in processing transactions in blocks only mode.
Previously unsolicited transactions would be processed as normal.
2015-11-20 16:07:12 -08:00
Patick Strateman 3587f6a024 Fix relay mechanism for whitelisted peers under blocks only mode.
Previously in blocks only mode all inv messages where type!=MSG_BLOCK would be
rejected without regard for whitelisting or whitelistalwaysrelay.

As such whitelisted peers would never send the transaction (which would be
processed).
2015-11-20 16:07:12 -08:00
Wladimir J. van der Laan 776848acef
Merge pull request #6979
c197798 [Qt] simple mempool info in debug window (Jonas Schnelli)
2015-11-20 14:34:11 +01:00
Pavel Janík 5c2fd38d05 Add missing "blocktime" description to listtransactions help, fix formatting. 2015-11-20 12:51:36 +01:00
Wladimir J. van der Laan 3522f49f5a http: add Boost 1.49 compatibility
`try_join_for` was introduced in Boost 1.50:
http://www.boost.org/doc/libs/1_50_0/doc/html/thread/thread_management.html#thread.thread_management.thread.try_join_for

1.49 has `timed_join`, one can accomplish the same with:
http://www.boost.org/doc/libs/1_49_0/doc/html/thread/thread_management.html#thread.thread_management.thread.timed_join

However, `timed_join` was deprecated in 1.50. So a conditional is
necessary.

This solution was tested in #7031.
2015-11-20 10:14:21 +01:00
Jonas Schnelli c197798d1b
[Qt] simple mempool info in debug window 2015-11-20 08:40:43 +01:00
Alex Morcos c0353064dd Change GetPriority calculation.
Compute the value of inputs that already are in the chain at time of mempool entry and only increase priority due to aging for those inputs.  This effectively changes the CTxMemPoolEntry's GetPriority calculation from an upper bound to a lower bound.
2015-11-19 21:44:35 -05:00
Alex Morcos 71f1d9fd4a Modify variable names for entry height and priority 2015-11-19 21:28:01 -05:00
Alex Morcos 5945819717 Remove default arguments for CTxMemPoolEntry() 2015-11-19 21:28:01 -05:00
Wladimir J. van der Laan 52c563710d
qt: Periodic translations update 2015-11-19 12:58:09 +01:00
Wladimir J. van der Laan a1907772f0
Merge pull request #7051
b4f3e9c ui: Add "Copy raw transaction data" to transaction list context menu (Wladimir J. van der Laan)
2015-11-19 12:52:27 +01:00
Wladimir J. van der Laan b4f3e9c09e ui: Add "Copy raw transaction data" to transaction list context menu
Add a way to quickly copy transaction hex.

Primarily useful when manually submitting transactions,
e.g. `-walletbroadcast=0` is set.
2015-11-19 11:08:29 +01:00
Daniel Cousens ffacd27def zmq: prepend zmq to debug messages 2015-11-19 13:32:14 +11:00
Daniel Cousens 14075b189d init: add zmq to debug categories 2015-11-19 13:17:36 +11:00
Daniel Cousens cdcd816a1b init: amend ZMQ flag names 2015-11-19 12:34:19 +11:00
Jonas Schnelli f71bfefcb0
add UI help for -resetguisettings 2015-11-18 21:50:32 +01:00
Alex Morcos 8504867b14 Save the last unnecessary database read
It's possible coins with the same hash exist when you create a duplicate coinbase, so previously we were reading from the database to make sure we had the old coins cached so if we were to spend the new ones, the old ones would also be spent.  This pull instead just marks the new coins as not fresh if they are from a coinbase, so if they are spent they will be written all the way down to the database anyway overwriting any duplicates.
2015-11-18 12:16:40 -05:00
Alex Morcos 072e2f8644 Alter assumptions in CCoinsViewCache::BatchWrite
Previously it would break if you flushed a parent cache while there was a child cache referring to it.  This change will allow the flushing of parent caches.
2015-11-18 12:03:50 -05:00
Wladimir J. van der Laan 73fa5e6043
Merge pull request #6932
1cf3dd8 Add unit test for UpdateCoins (Alex Morcos)
03c8282 Make CCoinsViewTest behave like CCoinsViewDB (Alex Morcos)
14470f9 ModifyNewCoins saves database lookups (Alex Morcos)
2015-11-18 17:37:58 +01:00
Jonas Schnelli 03403d8c0f
Merge pull request #6951
513686d [qt] Use maxTxFee instead of 10000000 (MarcoFalke)
2015-11-18 14:28:21 +01:00
Jonas Schnelli 2a8e8c2e37
[Qt] don't allow to store invalid proxy ports 2015-11-18 14:02:14 +01:00
Alex Morcos e855b0152f Fix debug log message for block files 2015-11-17 22:23:39 -05:00
Luke Dashjr 2aa49ce9fe Bugfix: Use unique autostart filenames on Linux for testnet/regtest 2015-11-17 20:31:00 +00:00
Alex Morcos e587bc3fd9 Implement helper class for CTxMemPoolEntry constructor
This is only for unit tests.
2015-11-16 20:41:32 -05:00
Gregory Maxwell 87ee0e2dbc
Merge pull request #6986
6bc9e40 Chainparams: Explicit CChainParams arg for miner: (Jorge Timón)
598e494 Chainparams: Explicit CChainParams arg for main (pre miner): (Jorge Timón)
2015-11-16 17:00:11 -08:00
Gregory Maxwell 972bf9c529
Merge pull request #6999
f6d9d5e add (max)uploadtarget infos to getnettotals RPC help (Jonas Schnelli)
2015-11-16 16:39:33 -08:00
Gregory Maxwell 0a547d2d55
Merge pull request #7023
4d29032 Fixed integer comparison warning. (Eric Lombrozo)
2015-11-16 16:34:51 -08:00
Alex Morcos 56106a3300 Expose RPC calls for estimatesmart functions
Also add testing for estimatesmartfee in smartfees.py
2015-11-16 15:42:31 -05:00
Alex Morcos e93a236d7a add estimateSmartFee to the unit test 2015-11-16 15:33:06 -05:00
Alex Morcos 6303051470 EstimateSmart functions consider mempool min fee 2015-11-16 15:33:06 -05:00
Alex Morcos f22ac4a22c Increase success threshold for fee estimation to 95%
This provides more conservative estimates and reacts more quickly to a backlog.
Unfortunately the unit test for fee estimation depends on the success threshold (and the decay) chosen; also modify the unit test for the new default success thresholds.
2015-11-16 15:33:06 -05:00
Alex Morcos 4fe28236c0 Change wallet and GUI code to use new smart fee estimation calls. 2015-11-16 15:33:06 -05:00
Alex Morcos 22eca7da22 Add smart fee estimation functions
These are more useful fee and priority estimation functions. If there is no fee/pri high enough for the target you are aiming for, it will give you the estimate for the lowest target that you can reliably obtain.  This is better than defaulting to the minimum.  It will also pass back the target for which it returned an answer.
2015-11-16 15:33:06 -05:00
Wladimir J. van der Laan e54ebbf600
Merge pull request #6954
6e18268 Switch to libsecp256k1-based validation for ECDSA (Pieter Wuille)
2015-11-16 13:25:18 +01:00
Wladimir J. van der Laan dafefb7924
Merge pull request #7016
aee22bf Avoid a compile error on hosts with libevent too old for EVENT_LOG_WARN. (Gregory Maxwell)
2015-11-16 12:03:19 +01:00
Jonas Schnelli d16d1b72d1
[Qt] refactor and optimize proxy settings behavior 2015-11-16 11:05:26 +01:00
Gregory Maxwell aee22bf288 Avoid a compile error on hosts with libevent too old for EVENT_LOG_WARN.
This uses _EVENT_LOG_WARN instead, which appears to be defined in the
 old versions of libevent that I have on some systems.
2015-11-16 09:21:54 +00:00
Gregory Maxwell 6876a78b86
Merge pull request #6991
9bd3f03 Clarify 'fee' field in fundrawtransaction help text (Peter Todd)
2015-11-16 00:38:08 -08:00
Jonas Schnelli 814697c556
Merge pull request #7000
773ae46 [Qt] add shortcurts for debug-/console-window (Jonas Schnelli)
2015-11-16 08:39:42 +01:00
Eric Lombrozo 4d29032a64 Fixed integer comparison warning. 2015-11-15 20:13:30 -05:00
Pieter Wuille 6e18268616 Switch to libsecp256k1-based validation for ECDSA 2015-11-15 16:06:57 +01:00
Gregory Maxwell b632145ede
Merge pull request #6993
bbf49da Fix comment for blocksonly parameter interactions (Patick Strateman)
6a4982f Fix fRelayTxs comment (Patick Strateman)
59441a0 Display DEFAULT_WHITELISTALWAYSRELAY in help text (Patick Strateman)
71a2683 Use DEFAULT_BLOCKSONLY and DEFAULT_WHITELISTALWAYSRELAY constants (Patick Strateman)
762b13b Add help text for blocksonly and whitelistalwaysrelay (Patick Strateman)
3a96497 Add whitelistalwaysrelay option (Patick Strateman)
420fa81 Do not process tx inv's in blocksonly mode (Patick Strateman)
4044f07 Add blocksonly mode (Patick Strateman)
2015-11-14 05:23:00 -08:00
Patick Strateman bbf49da408 Fix comment for blocksonly parameter interactions 2015-11-14 05:14:01 -08:00
Patick Strateman 6a4982fb83 Fix fRelayTxs comment 2015-11-14 05:12:31 -08:00
Patick Strateman 59441a0445 Display DEFAULT_WHITELISTALWAYSRELAY in help text 2015-11-14 05:12:05 -08:00
Patick Strateman 71a2683f4b Use DEFAULT_BLOCKSONLY and DEFAULT_WHITELISTALWAYSRELAY constants 2015-11-14 05:10:59 -08:00
Patick Strateman 762b13b4d8 Add help text for blocksonly and whitelistalwaysrelay 2015-11-14 04:54:01 -08:00
Patick Strateman 3a964973fe Add whitelistalwaysrelay option 2015-11-14 04:52:21 -08:00
Patick Strateman 420fa8143a Do not process tx inv's in blocksonly mode 2015-11-14 04:52:21 -08:00
Patick Strateman 4044f07d1c Add blocksonly mode 2015-11-14 04:52:21 -08:00
Gregory Maxwell 9ffc687288
Merge pull request #6984
e495ed5 add documentation for exluding whitelistes peer from maxuploadtarget (Jonas Schnelli)
5760749 [docs] rename reducetraffic.md to reduce-traffic.md (Jonas Schnelli)
d61fcff don't enforce maxuploadtargets disconnect for whitelisted peers (Jonas Schnelli)
2015-11-13 23:54:36 -08:00
Wladimir J. van der Laan 36baa9f475
Merge pull request #7013
b3ae384 Remove LOCK(cs_main) from decodescript (Peter Todd)
2015-11-14 08:24:44 +01:00
Peter Todd b3ae384a8d
Remove LOCK(cs_main) from decodescript
Completely static RPC call that doesn't change or even look at mutable
state anywhere.
2015-11-13 17:19:33 -05:00
Peter Todd 6531f17a78
Add mediantime field to getblock and getblockheader 2015-11-13 16:57:10 -05:00
Peter Todd 7259769d7f Document new mediantime field in getblockchaininfo 2015-11-13 16:49:47 -05:00
Peter Todd c277a63ed7
Clarify nLockTime-by-time comment in CheckFinalTx() 2015-11-13 16:36:54 -05:00
Peter Todd 10953a7d32
Better error message for fundrawtransaction w/ empty vout
Previously this case failed deep in Cwallet::CreateTransaction() with
the error message "Transaction amounts must be positive"
2015-11-13 15:53:46 -05:00
Peter Todd 61e1eb2e1c
Actually use includeWatching value in fundrawtransaction
Previously if you called fundrawtransaction and set includeWatching to
false it'd act as through you set it to true.
2015-11-13 15:45:29 -05:00
Peter Todd 748321eb5b
Add mediantime field to getblockchaininfo RPC call
Useful now that BIP113 is enforced for transactions entering the
mempool. Was previously only (indirectly) available by calling
getblocktemplate, a relatively expensive RPC call.
2015-11-13 15:35:04 -05:00
Jonas Schnelli d61fcff071
don't enforce maxuploadtargets disconnect for whitelisted peers 2015-11-13 21:04:12 +01:00
Gregory Maxwell dbd2c135dd
Merge pull request #6990
a264c32 http: speed up shutdown (Wladimir J. van der Laan)
2015-11-13 11:30:00 -08:00
Wladimir J. van der Laan d3565604e3
Merge pull request #7007
a78e6ea Fix bug in mempool_tests unit test (Alex Morcos)
2015-11-13 18:37:46 +01:00
Pieter Wuille 114b5812f6 Prevector type 2015-11-13 18:15:20 +01:00
Pieter Wuille 4f09b77c7f
Merge pull request #6983
48edf57 Update key.cpp to new secp256k1 API (Pieter Wuille)
1d84107 Squashed 'src/secp256k1/' changes from 22f60a6..2bfb82b (Pieter Wuille)
2015-11-13 16:51:44 +01:00
Alex Morcos a78e6eaf5c Fix bug in mempool_tests unit test 2015-11-13 10:50:49 -05:00
Jonas Schnelli ae98388b22
[Qt] add startup option to reset Qt settings 2015-11-13 16:27:42 +01:00
Wladimir J. van der Laan d2e987aa19
Merge pull request #6958
9c3ee3b [doc] Add -maxuploadtarget release notes (MarcoFalke)
b27e81f [net] Cleanup maxuploadtarget (MarcoFalke)
2015-11-13 13:27:33 +01:00
Wladimir J. van der Laan a264c32e33
http: speed up shutdown
This continues/fixes #6719.

`event_base_loopbreak` was not doing what I expected it to, at least in
libevent 2.0.21.
What I expected was that it sets a timeout, given that no other pending
events it would exit in N seconds. However, what it does was delay the
event loop exit with 10 seconds, even if nothing is pending.

Solve it in a different way: give the event loop thread time to exit
out of itself, and if it doesn't, send loopbreak.

This speeds up the RPC tests a lot, each exit incurred a 10 second
overhead, with this change there should be no shutdown overhead in the
common case and up to two seconds if the event loop is blocking.

As a bonus this breaks dependency on boost::thread_group, as the HTTP
server minds its own offspring.
2015-11-13 11:10:48 +01:00
Pieter Wuille 48edf5746a Update key.cpp to new secp256k1 API 2015-11-13 00:12:53 +01:00
Pieter Wuille 1d84107924 Squashed 'src/secp256k1/' changes from 22f60a6..2bfb82b
2bfb82b Merge pull request #351
06aeea5 Turn secp256k1_ec_pubkey_serialize outlen to in/out
970164d Merge pull request #348
6466625 Improvements for coordinate decompression
e2100ad Merge pull request #347
8e48787 Change secp256k1_ec_pubkey_combine's count argument to size_t.
c69dea0 Clear output in more cases for pubkey_combine, adds tests.
269d422 Comment copyediting.
b4d17da Merge pull request #344
4709265 Merge pull request #345
26abce7 Adds 32 static test vectors for scalar mul, sqr, inv.
5b71a3f Better error case handling for pubkey_create & pubkey_serialize, more tests.
3b7bc69 Merge pull request #343
eed87af Change contrib/laxder from headers-only to files compilable as standalone C
d7eb1ae Merge pull request #342
7914a6e Make lax_der_privatekey_parsing.h not depend on internal code
73f64ff Merge pull request #339
9234391 Overhaul flags handling
1a36898 Make flags more explicit, add runtime checks.
1a3e03a Merge pull request #340
96be204 Add additional tests for eckey and arg-checks.
bb5aa4d Make the tweak function zeroize-output-on-fail behavior consistent.
4a243da Move secp256k1_ec_privkey_import/export to contrib.
1b3efc1 Move secp256k1_ecdsa_sig_recover into the recovery module.
e3cd679 Eliminate all side-effects from VERIFY_CHECK() usage.
b30fc85 Avoid nonce_function_rfc6979 algo16 argument emulation.
70d4640 Make secp256k1_ec_pubkey_create skip processing invalid secret keys.
6c476a8 Minor comment improvements.
131afe5 Merge pull request #334
0c6ab2f Introduce explicit lower-S normalization
fea19e7 Add contrib/lax_der_parsing.h
3bb9c44 Rewrite ECDSA signature parsing code
fa57f1b Use secp256k1_rand_int and secp256k1_rand_bits more
49b3749 Add new tests for the extra testrand functions
f684d7d Faster secp256k1_rand_int implementation
251b1a6 Improve testrand: add extra random functions
31994c8 Merge pull request #338
f79aa88 Bugfix: swap arguments to noncefp
c98df26 Merge pull request #319
67f7da4 Extensive interface and operations tests for secp256k1_ec_pubkey_parse.
ee2cb40 Add ARG_CHECKs to secp256k1_ec_pubkey_parse/secp256k1_ec_pubkey_serialize
7450ef1 Merge pull request #328
68a3c76 Merge pull request #329
98135ee Merge pull request #332
37100d7 improve ECDH header-doc
b13d749 Fix couple of typos in API comments
7c823e3 travis: fixup module configs
cc3141a Merge pull request #325
ee58fae Merge pull request #326
213aa67 Do not force benchmarks to be statically linked.
338fc8b Add API exports to secp256k1_nonce_function_default and secp256k1_nonce_function_rfc6979.
52fd03f Merge pull request #320
9f6993f Remove some dead code.
357f8cd Merge pull request #314
118cd82 Use explicit symbol visibility.
4e64608 Include public module headers when compiling modules.
1f41437 Merge pull request #316
fe0d463 Merge pull request #317
cfe0ed9 Fix miscellaneous style nits that irritate overactive static analysis.
2b199de Use the explicit NULL macro for pointer comparisons.
9e90516 Merge pull request #294
dd891e0 Get rid of _t as it is POSIX reserved
201819b Merge pull request #313
912f203 Eliminate a few unbraced statements that crept into the code.
eeab823 Merge pull request #299
486b9bb Use a flags bitfield for compressed option to secp256k1_ec_pubkey_serialize and secp256k1_ec_privkey_export
05732c5 Callback data: Accept pointers to either const or non-const data
1973c73 Bugfix: Reinitialise buffer lengths that have been used as outputs
788038d Use size_t for lengths (at least in external API)
c9d7c2a secp256k1_context_set_{error,illegal}_callback: Restore default handler by passing NULL as function argument
9aac008 secp256k1_context_destroy: Allow NULL argument as a no-op
64b730b secp256k1_context_create: Use unsigned type for flags bitfield
cb04ab5 Merge pull request #309
a551669 Merge pull request #295
81e45ff Update group_impl.h
85e3a2c Merge pull request #112
b2eb63b Merge pull request #293
dc0ce9f [API BREAK] Change argument order to out/outin/in
6d947ca Merge pull request #298
c822693 Merge pull request #301
6d04350 Merge pull request #303
7ab311c Merge pull request #304
5fb3229 Fixes a bug where bench_sign would fail due to passing in too small a buffer.
263dcbc remove unused assignment
b183b41 bugfix: "ARG_CHECK(ctx != NULL)" makes no sense
6da1446 build: fix parallel build
5eb4356 Merge pull request #291
c996d53 Print success
9f443be Move pubkey recovery code to separate module
d49abbd Separate ECDSA recovery tests
439d34a Separate recoverable and normal signatures
a7b046e Merge pull request #289
f66907f Improve/reformat API documentation secp256k1.h
2f77487 Add context building benchmarks
cc623d5 Merge pull request #287
de7e398 small typo fix
9d96e36 Merge pull request #280
432e1ce Merge pull request #283
14727fd Use correct name in gitignore
356b0e9 Actually test static precomputation in Travis
ff3a5df Merge pull request #284
2587208 Merge pull request #212
a5a66c7 Add support for custom EC-Schnorr-SHA256 signatures
d84a378 Merge pull request #252
72ae443 Improve perf. of cmov-based table lookup
92e53fc Implement endomorphism optimization for secp256k1_ecmult_const
ed35d43 Make `secp256k1_scalar_add_bit` conditional; make `secp256k1_scalar_split_lambda_var` constant time
91c0ce9 Add benchmarks for ECDH and const-time multiplication
0739bbb Add ECDH module which works by hashing the output of ecmult_const
4401500 Add constant-time multiply `secp256k1_ecmult_const` for ECDH
e4ce393 build: fix hard-coded usage of "gen_context"
b8e39ac build: don't use BUILT_SOURCES for the static context header
baa75da tests: add a couple tests
ae4f0c6 Merge pull request #278
995c548 Introduce callback functions for dealing with errors.
c333074 Merge pull request #282
18c329c Remove the internal secp256k1_ecdsa_sig_t type
74a2acd Add a secp256k1_ecdsa_signature_t type
23cfa91 Introduce secp256k1_pubkey_t type
4c63780 Merge pull request #269
3e6f1e2 Change rfc6979 implementation to be a generic PRNG
ed5334a Update configure.ac to make it build on OpenBSD
1b68366 Merge pull request #274
a83bb48 Make ecmult static precomputation default
166b32f Merge pull request #276
c37812f Add gen_context src/ecmult_static_context.h to CLEANFILES to fix distclean.
125c15d Merge pull request #275
76f6769 Fix build with static ecmult altroot and make dist.
5133f78 Merge pull request #254
b0a60e6 Merge pull request #258
733c1e6 Add travis build to test the static context.
fbecc38 Add ability to use a statically generated ecmult context.
4fb174d Merge pull request #263
4ab8990 Merge pull request #270
bdf0e0c Merge pull request #271
31d0c1f Merge pull request #273
eb2c8ff Add missing casts to SECP256K1_FE_CONST_INNER
55399c2 Further performance improvements to _ecmult_wnaf
99fd963 Add secp256k1_ec_pubkey_compress(), with test similar to the related decompress() function.
145cc6e Improve performance of _ecmult_wnaf
36b305a Verify the result of GMP modular inverse using non-GMP code
0cbc860 Merge pull request #266
06ff7fe Merge pull request #267
5a43124 Save 1 _fe_negate since s1 == -s2
a5d796e Update code comments
3f3964e Add specific VERIFY tests for _fe_cmov
7d054cd Refactor to save a _fe_negate
b28d02a Refactor to remove a local var
55e7fc3 Perf. improvement in _gej_add_ge
a0601cd Fix VERIFY calculations in _fe_cmov methods
17f7148 Merge pull request #261
7657420 Add tests for adding P+Q with P.x!=Q.x and P.y=-Q.y
8c5d5f7 tests: Add failing unit test for #257 (bad addition formula)
5de4c5d gej_add_ge: fix degenerate case when computing P + (-lambda)P
bcf2fcf gej_add_ge: rearrange algebra
e2a07c7 Fix compilation with C++
873a453 Merge pull request #250
91eb0da Merge pull request #247
210ffed Use separate in and out pointers in `secp256k1_ec_pubkey_decompress`
a1d5ae1 Tiny optimization
729badf Merge pull request #210
2d5a186 Apply effective-affine trick to precomp
4f9791a Effective affine addition in EC multiplication
2b4cf41 Use pkg-config always when possible, with failover to manual checks for libcrypto

git-subtree-dir: src/secp256k1
git-subtree-split: 2bfb82b10edf0f0b0e366a12f94c8b21a914159d
2015-11-13 00:12:43 +01:00
Pieter Wuille 9e475d5a4d Update libsecp256k1 2015-11-13 00:12:43 +01:00
Jeff Garzik 38ed190eef
Merge #6771 from branch 'lowerLimits' of git://github.com/morcos/bitcoin 2015-11-12 15:38:59 -05:00
MarcoFalke b27e81f115 [net] Cleanup maxuploadtarget
* log: nMaxOutboundLimit is in bytes
* log: Hide misleading -maxuploadtarget=0 warning
* qa : Minor cleanup to maxuploadtarget rpc tests
* net: Use DEFAULT_MAX_UPLOAD_TARGET = 0
2015-11-12 20:45:57 +01:00
Wladimir J. van der Laan bd629d77ed
Merge pull request #6639
58ef0ff doc: update docs for Tor listening (Wladimir J. van der Laan)
68ccdc4 doc: Mention Tor listening in release notes (Wladimir J. van der Laan)
09c1ae1 torcontrol improvements and fixes (Wladimir J. van der Laan)
2f796e5 Better error message if Tor version too old (Peter Todd)
8f4e67f net: Automatically create hidden service, listen on Tor (Wladimir J. van der Laan)
2015-11-12 19:24:59 +01:00
Wladimir J. van der Laan 09c1ae1c01 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
2015-11-12 17:58:15 +01:00
Wladimir J. van der Laan eb6172a8ca
Merge pull request #6918
69d373f Don't wipe the sigcache in TestBlockValidity (Pieter Wuille)
0b9e9dc Evict sigcache entries that are seen in a block (Pieter Wuille)
830e3f3 Make sigcache faster and more efficient (Pieter Wuille)
2015-11-12 17:37:52 +01:00
Alex Morcos 1cf3dd80a6 Add unit test for UpdateCoins 2015-11-12 09:55:12 -05:00
Jonas Schnelli f6d9d5ee75
add (max)uploadtarget infos to getnettotals RPC help 2015-11-12 15:01:30 +01:00
Pieter Wuille 54e8bfec83
Merge pull request #6931
33c90cf Make skipping BIP30 check chain agnostic (Alex Morcos)
06d81ad Skip BIP30 check after BIP34 activation (Alex Morcos)
2015-11-12 14:37:10 +01:00
Jonas Schnelli 773ae4654e
[Qt] add shortcurts for debug-/console-window 2015-11-12 13:54:06 +01:00
Alex Morcos 03c82826f9 Make CCoinsViewTest behave like CCoinsViewDB 2015-11-11 21:19:19 -05:00
Peter Todd 9bd3f035f0
Clarify 'fee' field in fundrawtransaction help text
Previous text could be interpreted as the the _additional_ fee paid by
the result on top of the fee the original version paid, rather than the
correct interpretation: the absolute fee the resulting tx pays.
2015-11-11 13:52:03 -05:00
Wladimir J. van der Laan 2f71b07d5e
Merge pull request #6974
40b77d4 Always allow getheaders from whitelisted peers (Wladimir J. van der Laan)
2015-11-11 18:30:17 +01:00
Jorge Timón 6bc9e4056b Chainparams: Explicit CChainParams arg for miner:
-BitcoinMiner
-CreateNewBlock
-GenerateBitcoins
-ProcessBlockFound
2015-11-11 13:21:17 +01:00
Jorge Timón 598e494587 Chainparams: Explicit CChainParams arg for main (pre miner):
-ProcessNewBlock
-TestBlockValidity
2015-11-11 13:21:17 +01:00
Wladimir J. van der Laan 3ac7060934
Merge pull request #6978
69d0513 build: Use fPIC rather than fPIE for qt objects. (Cory Fields)
17c4d9d build: Split hardening/fPIE options out (Cory Fields)
2015-11-11 12:54:57 +01:00
Wladimir J. van der Laan cb841e7513
Merge pull request #6982
7267843 Globals: Make AcceptBlockHeader static (Fix #6163) (Jorge Timón)
2015-11-11 12:23:33 +01:00
Jorge Timón 7267843745 Globals: Make AcceptBlockHeader static (Fix #6163)
..and at the same time prevent AcceptBlockHeader() from calling global function Params()
2015-11-11 01:33:39 +01:00
Peter Todd 16a2f93629
Fix incorrect locking of mempool during RBF replacement
Previously RemoveStaged() was called without pool.cs held.
2015-11-10 18:00:24 -05:00
Suhas Daftuar 73d904009d Improve RBF replacement criteria
Fix the calculation of conflicting size/conflicting fees.
2015-11-10 14:14:07 -05:00
Peter Todd b272ecfdb3 Reject replacements that add new unconfirmed inputs 2015-11-10 14:14:07 -05:00
Peter Todd fc8c19a07c Prevent low feerate txs from (directly) replacing high feerate txs
Previously all conflicting transactions were evaluated as a whole to
determine if the feerate was being increased. This meant that low
feerate children pulled the feerate down, potentially allowing a high
transaction with a high feerate to be replaced by one with a lower
feerate.
2015-11-10 14:14:07 -05:00
Peter Todd 5891f870d6 Add opt-in full-RBF to mempool
Replaces transactions already in the mempool if a new transaction seen
with a higher fee, specifically both a higher fee per KB and a higher
absolute fee. Children are evaluateed for replacement as well, using the
mempool package tracking to calculate replaced fees/size. Transactions
can opt-out of transaction replacement by setting nSequence >= maxint-1
on all inputs. (which all wallets do already)
2015-11-10 14:14:06 -05:00
Wladimir J. van der Laan de7d4591a7
Merge pull request #6965
77f1f59 Benchmark sanity checks and fork checks in ConnectBlock (Matt Corallo)
2015-11-10 19:18:51 +01:00
Peter Todd 2f796e5fe7 Better error message if Tor version too old 2015-11-10 17:29:56 +01:00
Wladimir J. van der Laan 8f4e67f152 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.
2015-11-10 17:29:56 +01:00
Wladimir J. van der Laan b56953e9bb
qt: Periodic translations update 2015-11-10 16:44:53 +01:00
Wladimir J. van der Laan 32d8b1570c
Merge pull request #6940
7ca73dc Improving labels for Sent / Received "Bytes" (Jonathan Cross)
2015-11-10 16:39:12 +01:00
Wladimir J. van der Laan 9fa54a1b0c
Merge pull request #6822
e20d924 [trivial] init: Use defaults MIN_RELAY_TX_FEE & TRANSACTION_MAXFEE (MarcoFalke)
536766c [trivial] New DEFAULT_MIN_RELAY_TX_FEE = 1000 (MarcoFalke)
5f46a7d transaction_tests: Be more strict checking dust (MarcoFalke)
2015-11-10 15:58:00 +01:00
Wladimir J. van der Laan 755b4ba848
Merge pull request #5574
fd55571 wallet: Expose GUI labels in RPC (Luke Dashjr)
2015-11-10 15:48:23 +01:00
Wladimir J. van der Laan 77beab70de
Merge pull request #6163
87cbdb8 Globals: Explicit Consensus::Params arg for main: (Jorge Timón)
2015-11-10 15:32:03 +01:00
Cory Fields 69d0513436 build: Use fPIC rather than fPIE for qt objects.
But only if qt was built with reduced relocations.
2015-11-09 22:50:31 -05:00
Cory Fields 17c4d9d164 build: Split hardening/fPIE options out
This allows for fPIE to be used selectively.
2015-11-09 22:50:31 -05:00
MarcoFalke e20d9245e5 [trivial] init: Use defaults MIN_RELAY_TX_FEE & TRANSACTION_MAXFEE 2015-11-09 21:12:55 +01:00
MarcoFalke 536766c903 [trivial] New DEFAULT_MIN_RELAY_TX_FEE = 1000 2015-11-09 21:00:16 +01:00
MarcoFalke 5f46a7d068 transaction_tests: Be more strict checking dust
* Don't allow off-by-one or more
* Make clear dust is coupled with minRelayTxFee
* Check rounding for odd values
2015-11-09 21:00:16 +01:00
Wladimir J. van der Laan 40b77d450d Always allow getheaders from whitelisted peers
Process `getheaders` messages from whitelisted peers even if we are in
initial block download. Whitelisted peers can always use a node as a
block source.

Also log a debug message when the request is ignored, for
troubleshooting.

Fixes #6971.
2015-11-09 14:28:49 +01:00
Wladimir J. van der Laan f24880b132
Merge pull request #6908
c53d48a BIP70: Chainparams: DRY: Make qt/guiutil.cpp fit BIP70 chain name strings (Jorge Timón)
2015-11-09 14:19:05 +01:00
Wladimir J. van der Laan 6176e9bf3d
Merge pull request #6962
6dd3a44 translations: Don't translate markdown or force English grammar (MarcoFalke)
2015-11-09 12:09:33 +01:00
MarcoFalke 6dd3a44ce2 translations: Don't translate markdown or force English grammar 2015-11-09 11:40:52 +01:00
Wladimir J. van der Laan 2980a18572 Fix crash in validateaddress with -disablewallet
Fix a null pointer dereference in validateaddress with -disablewallet. Also add a regression testcase.
2015-11-09 08:44:19 +01:00
Matt Corallo 77f1f59d12 Benchmark sanity checks and fork checks in ConnectBlock 2015-11-06 15:21:14 -08:00
Wladimir J. van der Laan 4ee149a6db
Merge pull request #6955
e167af2 [doc] Remove excessive white space (MarcoFalke)
e0eeb67 [trivial] clang-format: Set AlignAfterOpenBracket: false (MarcoFalke)
0af8fe4 devtools: Update README.md (MarcoFalke)
2015-11-05 23:39:48 +01:00
MarcoFalke e0eeb672f2 [trivial] clang-format: Set AlignAfterOpenBracket: false 2015-11-05 23:28:02 +01:00
Wladimir J. van der Laan 849a7e6453
Merge pull request #6948
22e7807 Always flush block and undo when switching to new file (Pieter Wuille)
2015-11-05 23:06:34 +01:00
MarcoFalke 513686dd43 [qt] Use maxTxFee instead of 10000000 2015-11-05 19:16:29 +01:00
Wladimir J. van der Laan 3038eb63e8
Merge pull request #6934
d1c3762 Revert "Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints"" (Gregory Maxwell)
e4e5334 Restore MedianTimePast for locktime. (Gregory Maxwell)
2015-11-05 12:13:04 +01:00
Wladimir J. van der Laan 3694b74fa9
Merge pull request #6887
53238ff Clarify what minrelaytxfee does (MarcoFalke)
abd8b76 [qt] Properly display required fee instead of minTxFee (MarcoFalke)
2015-11-05 12:11:11 +01:00
Pieter Wuille 22e780737d Always flush block and undo when switching to new file
Previously, the undo weren't being flushed during a reindex because
fKnown was set to true in FindBlockPos. That is the correct behaviour
for block files as they aren't being touched, but undo files are
touched.

This changes the behaviour to always flush when switching to a new file
(even for block files, though that isn't really necessary).
2015-11-05 00:43:49 +01:00
Pieter Wuille f0343e9370 Update LevelDB 2015-11-04 23:46:47 +01:00
Peter Josling e482a7fe6b Fix CCoins serialization documentation
The docs talk about bits 2 and 4 instead of 2 and 3, and bits are being
indexed from both 1 (describing nCode) and 0 (in second example).
Changed to use zero-indexing for all.
2015-11-04 20:15:54 +00:00
Jonathan Cross 7ca73dcf6b Improving labels for Sent / Received "Bytes"
The labels for Sent & Received data in the "Peers" debug panel should not be defined as "Bytes" because the units (B, KB, MB) appear after the number.  I decided to simply use "Sent" and "Received" (rather than "Data Sent" and "Data Received") because we already have translations for the former:
https://www.transifex.com/bitcoin/bitcoin/viewstrings/#ja/qt-translation-011x/47533089?q=sent
https://www.transifex.com/bitcoin/bitcoin/viewstrings/#ja/qt-translation-011x/47533089?q=received

Demo of changes:

Current UI:
    Bytes Sent      12 KB
    Bytes Received  26 MB

With this pull request:
    Sent       12 KB
    Received   26 MB
2015-11-04 20:14:16 +01:00
Jorge Timón c53d48a6b3 BIP70: Chainparams: DRY: Make qt/guiutil.cpp fit BIP70 chain name strings
As a side effect, the qt user will see "test" instead of "testnet"
2015-11-04 14:02:10 +01:00
Wladimir J. van der Laan c702521a85
Merge pull request #6864
268b79e [qt] rpcconsole: Scale monospace font to 95% (MarcoFalke)
28313b8 [qt] Use fixed pitch font for the rpc console (MarcoFalke)
2015-11-04 13:06:14 +01:00
Wladimir J. van der Laan 8a95a18562
Merge pull request #6669
6342a48 Init: Use DEFAULT_TRANSACTION_MINFEE in help message (MarcoFalke)
a9c73a1 [wallet] Add comments for doxygen (MarcoFalke)
6b0e622 [wallet] Refactor to use new MIN_CHANGE (MarcoFalke)
2015-11-04 12:30:50 +01:00
Wladimir J. van der Laan aa03fb35c4
Merge pull request #6927
de0499d Fix ZMQ Notification initialization and shutdown (João Barbosa)
2015-11-04 12:10:46 +01:00
Wladimir J. van der Laan aca0c00ae1
Merge pull request #6905
a6efc01 Bugfix: Omit wallet-related options from -help when wallet is disabled (Luke Dashjr)
5f9260f Bugfix: If genproclimit is omitted to RPC setgenerate, don't change it; also show correct default in getmininginfo (Luke Dashjr)
420a82f Bugfix: Describe dblogsize option correctly (it refers to the wallet database, not memory pool) (Luke Dashjr)
caa3d42 Bugfix: RPC: blockchain: Display correct defaults in help for verifychain method (Luke Dashjr)
2015-11-04 11:45:33 +01:00
João Barbosa de0499d3b8 Fix ZMQ Notification initialization and shutdown
Moves the call Initialize() from init.cpp to CreateWithArguments() and handles the
return value. Moves the call Shutdown() from init.cpp to destructor.
Changes Initialize() and Shutdown() to protected members.
2015-11-04 10:36:00 +00:00
Gregory Maxwell d1c3762ae8 Revert "Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints""
This reverts commit 8537ecdfc4.
2015-11-03 17:14:09 +00:00
Gregory Maxwell e4e5334ef8 Restore MedianTimePast for locktime.
Revert "Revert "Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations""
This reverts commit 40cd32e835.

After careful analysis it was determined that the change was, in fact, safe and several people were suffering
momentary confusion about locktime semantics.
2015-11-03 17:12:36 +00:00
MarcoFalke 268b79ef0c [qt] rpcconsole: Scale monospace font to 95% 2015-11-03 12:34:51 +01:00
MarcoFalke 53238ff0b1 Clarify what minrelaytxfee does 2015-11-03 08:53:37 +01:00
MarcoFalke abd8b768ee [qt] Properly display required fee instead of minTxFee 2015-11-03 08:53:37 +01:00
Alex Morcos 14470f9aa6 ModifyNewCoins saves database lookups
When processing a new transaction, in addition to spending the Coins of its txin's it creates a new Coins for its outputs.  The existing ModifyCoins function will first make sure this Coins does not already exist.  It can not exist due to BIP 30, but because of that the lookup can't be cached and always has to go to the database.  Since we are creating the coins to match the new tx anyway, there is no point in checking if they exist first anyway.  However this should not be used for coinbase tx's in order to preserve the historical behavior of overwriting the two existing duplicate tx pairs.
2015-11-02 21:27:15 -05:00
Alex Morcos 33c90cf197 Make skipping BIP30 check chain agnostic 2015-11-02 20:11:55 -05:00
Alex Morcos 06d81ad516 Skip BIP30 check after BIP34 activation 2015-11-02 20:10:24 -05:00
Wladimir J. van der Laan 8fe30fb4d1
Merge pull request #6928
40cd32e Revert "Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations" (Gregory Maxwell)
8537ecd Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints" (Gregory Maxwell)
2015-11-02 04:44:47 +01:00
Wladimir J. van der Laan a6d0d623fc
Merge pull request #6926
7497e80 tests: Initialize networking on windows (Wladimir J. van der Laan)
2015-11-02 04:29:45 +01:00
Pieter Wuille 69d373ff66 Don't wipe the sigcache in TestBlockValidity 2015-11-02 02:01:45 +01:00
Gregory Maxwell 40cd32e835 Revert "Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations"
This reverts commit 9d55050773.

As noted by Luke-Jr, under some conditions this will accept transactions which are invalid by the network
 rules.  This happens when the current block time is head of the median time past and a transaction's
 locktime is in the middle.

This could be addressed by changing the rule to MAX(this_block_time, MTP+offset) but this solution and
 the particular offset used deserve some consideration.
2015-11-01 20:05:18 +00:00
Gregory Maxwell 8537ecdfc4 Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints"
This reverts commit dea8d21fc6.
2015-11-01 20:05:16 +00:00
Wladimir J. van der Laan 02a95be977
qt: translation update prior to opening 0.12 translations
Also update transifex slug for new version.
2015-11-01 16:11:50 +01:00
Wladimir J. van der Laan 7497e805bd tests: Initialize networking on windows 2015-11-01 11:45:06 +01:00
Pieter Wuille 0b9e9dca4e Evict sigcache entries that are seen in a block 2015-10-31 01:15:11 +01:00
Pieter Wuille 830e3f3d02 Make sigcache faster and more efficient 2015-10-31 01:15:11 +01:00
Wladimir J. van der Laan 48b5b84ee5
Merge pull request #6906
30d9662 Reject invalid pubkeys when reading ckey items from the wallet. (Gregory Maxwell)
2015-10-31 00:39:50 +01:00
Wladimir J. van der Laan d482c0a7b2
Merge pull request #6896
e9e6163 Make -checkmempool=1 not fail through int32 overflow (Pieter Wuille)
2015-10-31 00:38:31 +01:00
Jorge Timón 87cbdb8b41 Globals: Explicit Consensus::Params arg for main:
-CheckBlockIndex
-DisconnectTip
-GetTransaction
-InvalidateBlock
-ProcessGetData
-ReadBlockFromDisk
2015-10-30 14:07:30 +01:00
Luke Dashjr a6efc01908 Bugfix: Omit wallet-related options from -help when wallet is disabled 2015-10-30 00:32:08 +01:00
Gregory Maxwell 30d9662bd7 Reject invalid pubkeys when reading ckey items from the wallet.
This makes the behavior more consistent with key objects and will
 reject some corrupted pubkeys (e.g. zero length).
2015-10-29 18:24:49 +00:00
MarcoFalke 28313b83fc [qt] Use fixed pitch font for the rpc console
Also:
* Preserve white space
* Make fixed font as large as default font
2015-10-29 18:01:39 +01:00
MarcoFalke 6342a4889b Init: Use DEFAULT_TRANSACTION_MINFEE in help message 2015-10-29 16:52:40 +01:00
Wladimir J. van der Laan 725539ea03
Merge pull request #6863
0be387a unittest: fix test for null tx input (Daniel Kraft)
2015-10-29 13:40:33 +01:00
Wladimir J. van der Laan b28c229324
Merge pull request #6899
a83f3c2 Add explicit shared_ptr constructor due to C++11 error (Bob McElrath)
2015-10-29 13:39:56 +01:00
Wladimir J. van der Laan b2ce2c1f0f
Merge pull request #6870
040c0ea Init: Cleanup error and warning strings (MarcoFalke)
6782f58 [trivial] Latest config.guess (MarcoFalke)
bf68191 [trivial] rpcnet: fix typo (MarcoFalke)
95f4291 [trivial] Rewrite help text for feature enabled by default (MarcoFalke)
2015-10-29 13:30:42 +01:00
Bob McElrath a83f3c2426 Add explicit shared_ptr constructor due to C++11 error 2015-10-28 22:25:32 -04:00
MarcoFalke 040c0ea093 Init: Cleanup error and warning strings
Also update doc/translation_strings_policy.md
2015-10-28 22:11:43 +01:00
MarcoFalke a9c73a130e [wallet] Add comments for doxygen 2015-10-28 11:15:48 +01:00
MarcoFalke 6b0e622c25 [wallet] Refactor to use new MIN_CHANGE
* Introduce new constant MIN_CHANGE and use it instead of the
hardcoded "CENT"
* Add test case for MIN_CHANGE
* Introduce new constant for -mintxfee default:
  DEFAULT_TRANSACTION_MINFEE = 1000
2015-10-28 10:52:46 +01:00
Alex Morcos 971a4e6b86 Lower default policy limits
Reduce the default limits on maximum number of transactions and the cumulative size of those transactions in both ancestor and descendant packages to 25 txs and 101kb total size.
2015-10-27 23:59:19 -04:00
Pieter Wuille e9e616323b Make -checkmempool=1 not fail through int32 overflow 2015-10-28 03:07:59 +01:00
Pieter Wuille 8daffe227b
Merge pull request #6891
ad5aae1 constify missing catch cases (Philip Kaufmann)
2015-10-28 02:34:09 +01:00
Pieter Wuille 4764f5db9d
Merge pull request #6892
214de7e [Trivial] ensure minimal header conventions (Philip Kaufmann)
2015-10-28 02:30:31 +01:00
Pieter Wuille e06c14fb59
Merge pull request #6776
ab1f560 Support -checkmempool=N, which runs checks on average once every N transactions (Pieter Wuille)
2015-10-28 02:25:06 +01:00
Pieter Wuille 298e040bca Fix chainstate serialized_size computation 2015-10-28 01:05:32 +01:00
Daniel Kraft 0be387a536 unittest: fix test for null tx input
Update the unittest that is meant to catch a transaction that is invalid
because it has a null input.  The old test failed not because of that
but because it was considered a coinbase with too large script.  This is
already checked with a different test, though.

The new test is *not* a coinbase since it has two inputs, but one of
them is null.  This really checks the corresponding code path in
CheckTransaction.
2015-10-27 20:11:56 +01:00
Philip Kaufmann 214de7e54c [Trivial] ensure minimal header conventions
- ensure header namespaces and end comments are correct
- add missing header end comments
- ensure minimal formatting (add newlines etc.)
2015-10-27 17:44:13 +01:00
Philip Kaufmann ad5aae15b4 constify missing catch cases
- ensure all missing catch cases are constant where possible
2015-10-27 17:39:42 +01:00
Wladimir J. van der Laan 8f3b3cdee4
Merge pull request #6464
2d8c49d Clean up tx prioritization when conflict mined (Casey Rodarmor)
2015-10-27 11:58:35 +01:00
Wladimir J. van der Laan 38369dda32
Merge pull request #6889
0d699fc fix locking issue with new mempool limiting (Jonas Schnelli)
2015-10-27 08:48:12 +01:00
Wladimir J. van der Laan 2b625510d3
Merge pull request #6881
7bbc7c3 Add option for microsecond precision in debug.log (Suhas Daftuar)
2015-10-26 21:04:41 +01:00
Suhas Daftuar 7bbc7c314f Add option for microsecond precision in debug.log 2015-10-26 15:05:37 -04:00
Wladimir J. van der Laan 7939164d89
Merge pull request #6622
17a073a Add RPC test for -maxuploadtarget (Suhas Daftuar)
872fee3 Introduce -maxuploadtarget (Jonas Schnelli)
2015-10-26 17:54:00 +01:00
Wladimir J. van der Laan c8322ff7f7
Merge pull request #6888
143d173 Use BOOST_CHECK_MESSAGE() rather than BOOST_CHECK() in alerts_tests.cpp and initialize strMiscWarning before calling PartitionCheck()." (Eric Lombrozo)
2015-10-26 17:25:19 +01:00
Jonas Schnelli 872fee3fcc
Introduce -maxuploadtarget
* -maxuploadtarget can be set in MiB
* if <limit> - ( time-left-in-24h-cycle / 600 * MAX_BLOCK_SIZE ) has reach, stop serve blocks older than one week and filtered blocks
* no action if limit has reached, no guarantee that the target will not be  surpassed
* add outbound limit informations to rpc getnettotals
2015-10-26 15:37:30 +01:00
Jonas Schnelli 0d699fc821
fix locking issue with new mempool limiting
Current master crashes on OSX with an exception: "boost: mutex lock failed in pthread_mutex_lock: Invalid argument"
2015-10-26 14:58:17 +01:00
Wladimir J. van der Laan ff057f41aa
Merge pull request #6566
dea8d21 Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints (Mark Friedenbach)
9d55050 Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations (Mark Friedenbach)
2015-10-26 11:32:46 +01:00
Wladimir J. van der Laan 26f5b34e88
Merge pull request #6877
10e2eae rpc: Add maxmempool and effective min fee to getmempoolinfo (Wladimir J. van der Laan)
2015-10-26 10:07:04 +01:00
Wladimir J. van der Laan 10e2eae35c rpc: Add maxmempool and effective min fee to getmempoolinfo 2015-10-26 09:59:07 +01:00
Eric Lombrozo 143d173969 Use BOOST_CHECK_MESSAGE() rather than BOOST_CHECK() in alerts_tests.cpp and initialize strMiscWarning before calling PartitionCheck()." 2015-10-25 05:47:02 -04:00
dexX7 d425877557
Remove coverage and test related files, when cleaning up
Until now there were quite a few leftovers, and only the coverage
related files in `src/` were cleaned, while the ones in the other dirs
remained. `qa/tmp/` is related to the BitcoinJ tests, and `cache/` is
related to RPC tests.
2015-10-23 22:09:14 +02:00
Mark Friedenbach dea8d21fc6 Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints
Transactions are not allowed in the memory pool or selected for inclusion in a block until their lock times exceed chainActive.Tip()->GetMedianTimePast(). However blocks including transactions which are only mature under the old rules are still accepted; this is *not* the soft-fork required to actually rely on the new constraint in production.
2015-10-23 09:02:24 -07:00
Mark Friedenbach 9d55050773 Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations
The lock-time code currently uses CBlock::nTime as the cutoff point for time based locked transactions. This has the unfortunate outcome of creating a perverse incentive for miners to lie about the time of a block in order to collect more fees by including transactions that by wall clock determination have not yet matured. By using CBlockIndex::GetMedianTimePast from the prior block instead, the self-interested miner no longer gains from generating blocks with fraudulent timestamps. Users can compensate for this change by simply adding an hour (3600 seconds) to their time-based lock times.

If enforced, this would be a soft-fork change. This commit only adds the functionality on an unexecuted code path, without changing the behaviour of Bitcoin Core.
2015-10-23 09:02:24 -07:00
Jeff Garzik 46f74379b8
Merge pull request #6873 2015-10-23 09:01:22 -04:00
Wladimir J. van der Laan c719cefc41
Merge pull request #6856
d3b09f6 Do not allow blockfile pruning during reindex. (Alex Morcos)
2015-10-23 14:41:30 +02:00
Wladimir J. van der Laan 2a1090d4f5
Merge pull request #6351
65ef372 Add BIP65 to getblockchaininfo softforks list (Peter Todd)
cde7ab2 Add RPC tests for the CHECKLOCKTIMEVERIFY (BIP65) soft-fork (Peter Todd)
287f54f Add CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic (Peter Todd)
2015-10-23 13:33:13 +02:00
Wladimir J. van der Laan bf7c1958d1
Merge pull request #5936
212bcca Add optional locktime to createrawtransaction (Tom Harding)
2015-10-23 12:47:19 +02:00
Wladimir J. van der Laan 923c5e93a9
Merge pull request #6818
b48da5c script:  Remove magic numbers (David Hill)
2015-10-23 11:50:10 +02:00
Wladimir J. van der Laan b2b173acab
Merge pull request #6867
a4e28b3 Set TCP_NODELAY on P2P sockets. (Gregory Maxwell)
2015-10-23 09:29:49 +02:00
MarcoFalke bf681918d7 [trivial] rpcnet: fix typo 2015-10-23 08:35:05 +02:00
Jeff Garzik 3795e8152b leveldbwrapper file rename to dbwrapper.* 2015-10-22 21:33:06 -04:00
Jeff Garzik 8587b23038 leveldbwrapper symbol rename: Remove "Level" from class, etc. names 2015-10-22 21:02:20 -04:00
Jeff Garzik 6ec4b7eb20 leveldbwrapper: Remove unused .Prev(), .SeekToLast() methods
Also, trim trailing whitespace.
2015-10-22 20:49:02 -04:00
Gregory Maxwell a4e28b3d1e Set TCP_NODELAY on P2P sockets.
Nagle appears to be a significant contributor to latency now that the static
 sleeps are gone.  Most of our messages are relatively large compared to
 IP + TCP so I do not expect this to create enormous overhead.

This may also reduce traffic burstyness somewhat.
2015-10-22 17:57:48 +00:00
Wladimir J. van der Laan f2c869aef2
Merge pull request #6848
c6824f8 Add DERSIG transaction test cases (J Ross Nicoll)
2015-10-22 18:02:17 +02:00
Wladimir J. van der Laan 2cd020d054
Merge pull request #6846
3cb56f3 *: alias -h for --help (Daniel Cousens)
2015-10-22 17:53:07 +02:00
Daniel Cousens 3cb56f3778 *: alias -h for --help 2015-10-22 00:07:30 +11:00
Wladimir J. van der Laan 0fbfc5106c
Merge pull request #6859
41db8c4 http: Restrict maximum size of request line + headers (Wladimir J. van der Laan)
2015-10-21 11:19:25 +02:00
Wladimir J. van der Laan 3b20e239c6
Merge pull request #6722
58254aa Fix stale comment in CTxMemPool::TrimToSize. (Matt Corallo)
2bc5018 Fix comment formatting tabs (Matt Corallo)
8abe0f5 Undo GetMinFee-requires-extra-call-to-hit-0 (Matt Corallo)
9e93640 Drop minRelayTxFee to 1000 (Matt Corallo)
074cb15 Add reasonable test case for mempool trimming (Matt Corallo)
d355cf4 Only call TrimToSize once per reorg/blocks disconnect (Matt Corallo)
794a8ce Implement on-the-fly mempool size limitation. (Matt Corallo)
e6c7b36 Print mempool size in KB when adding txn (Matt Corallo)
241d607 Add CFeeRate += operator (Matt Corallo)
e8bcdce Track (and define) ::minRelayTxFee in CTxMemPool (Matt Corallo)
9c9b66f Fix calling mempool directly, instead of pool, in ATMP (Matt Corallo)
49b6fd5 Add Mempool Expire function to remove old transactions (Pieter Wuille)
78b82f4 Reverse the sort on the mempool's feerate index (Suhas Daftuar)
2015-10-21 08:50:16 +02:00
Pieter Wuille ab1f56072a Support -checkmempool=N, which runs checks on average once every N transactions 2015-10-20 18:59:08 +02:00
Wladimir J. van der Laan e26a3f6713
Merge pull request #6235
55a8975 Chainparams: Translations: DRY: options and error strings (Jorge Timón)
f3525e2 Chainparams: Replace CBaseChainParams::Network enum with string constants (suggested by Wladimir) (Jorge Timón)
2015-10-20 17:06:28 +02:00
Wladimir J. van der Laan 41db8c4733 http: Restrict maximum size of request line + headers
Prevent memory exhaustion by sending lots of data.
Also add a test to `httpbasics.py`.

Closes #6425
2015-10-20 14:31:40 +02:00
Jorge Timón 55a89751fa Chainparams: Translations: DRY: options and error strings
Also remove SelectBaseParamsFromCommandLine and SelectParamsFromCommandLine
2015-10-20 14:28:43 +02:00
Jorge Timón f3525e24e3 Chainparams: Replace CBaseChainParams::Network enum with string constants (suggested by Wladimir) 2015-10-20 14:22:44 +02:00
Wladimir J. van der Laan c834f56869
Merge pull request #6853
7801f43 Added fPowNoRetargeting field to Consensus::Params that disables nBits recalculation. (Eric Lombrozo)
2015-10-20 12:07:44 +02:00
Wladimir J. van der Laan 488f8517a1
Merge pull request #6829
53b86d0 doc: add comment explaining initial header request (Daniel Kraft)
2015-10-20 12:06:44 +02:00
Alex Morcos d3b09f6bac Do not allow blockfile pruning during reindex.
Also clarify startup message.
2015-10-19 14:43:04 -04:00
Eric Lombrozo 7801f4387d Added fPowNoRetargeting field to Consensus::Params that disables nBits recalculation. 2015-10-19 14:25:21 -04:00
Matt Corallo 58254aa3bc Fix stale comment in CTxMemPool::TrimToSize. 2015-10-19 02:41:52 -07:00
J Ross Nicoll c6824f8a90 Add DERSIG transaction test cases
Add test cases for DERSIG flag enforcement against transactions.
2015-10-18 17:27:41 +01:00
David Hill b48da5c189 script: Remove magic numbers
This adds two new constants, MAX_OPS_PER_SCRIPT and
MAX_PUBKEYS_PER_MULTISIG.
2015-10-15 09:48:15 -04:00
Wladimir J. van der Laan d78a880900
Merge pull request #6820
60af755 build: univalue subdir build fixups (Cory Fields)
2015-10-15 12:55:25 +02:00
Matt Corallo 2bc50187ee Fix comment formatting tabs 2015-10-14 12:46:20 -07:00
Matt Corallo 8abe0f5658 Undo GetMinFee-requires-extra-call-to-hit-0 2015-10-14 12:44:18 -07:00
Daniel Kraft 53b86d0de5 doc: add comment explaining initial header request
Add a comment that explains why the initial "getheader" requests are
made starting from the block preceding the currently best one.

Thanks to sdaftuar for the explanation!
2015-10-14 20:42:49 +02:00
Daniel Kraft f8f2aceadd trivial: use constants for db keys
Replace literal occurances of the key "prefixes" 'c' and 'b' in txdb.cpp
by the respective constants.
2015-10-13 20:25:57 +02:00
Cory Fields 60af755e56 build: univalue subdir build fixups
- Force a rebuild if the headers change
- Only build the lib target
- Clean univalue on 'make clean'
2015-10-13 13:40:49 -04:00
Wladimir J. van der Laan 9caaf6ed22
Merge pull request #6777
dcd8e27 Refer to obfuscate_key via pointer in peripheral CLevelDB classes (James O'Beirne)
1488506 Add tests for gettxoutsetinfo, CLevelDBBatch, CLevelDBIterator (James O'Beirne)
0fdf8c8 Handle obfuscation in CLevelDBIterator (James O'Beirne)
3499ce1 Encapsulate CLevelDB iterators cleanly (Pieter Wuille)
2015-10-13 12:23:45 +02:00
Wladimir J. van der Laan 01f74999e3
Merge pull request #6798
700f52e Clarification of unit test build instructions. (Eric Lombrozo)
2015-10-13 11:35:24 +02:00
Wladimir J. van der Laan 97bee37d4c
Merge pull request #6788
3b1279f build: match upstream build change (Cory Fields)
313e7f5 Squashed 'src/univalue/' changes from 87d9045..5839ac3 (MarcoFalke)
2015-10-13 10:54:31 +02:00
Matt Corallo 9e93640be6 Drop minRelayTxFee to 1000
There is no exact science to setting this parameter, but 5000
(just over 1 US cent at the time of writing) is higher than the
cost to relay a transaction around the network (the new benchmark
due to mempool limiting).
2015-10-13 01:39:38 -07:00
Matt Corallo 074cb155c2 Add reasonable test case for mempool trimming 2015-10-13 01:39:38 -07:00
Matt Corallo d355cf4420 Only call TrimToSize once per reorg/blocks disconnect 2015-10-13 01:39:38 -07:00
Matt Corallo 794a8cec5d Implement on-the-fly mempool size limitation.
After each transaction which is added to mempool, we first call
Expire() to remove old transactions, then throwing away the
lowest-feerate transactions.

After throwing away transactions by feerate, we set the minimum
relay fee to the maximum fee transaction-and-dependant-set we
removed, plus the default minimum relay fee.

After the next block is received, the minimum relay fee is allowed
to decrease exponentially. Its halflife defaults to 12 hours, but
is decreased to 6 hours if the mempool is smaller than half its
maximum size, and 3 hours if the mempool is smaller than a quarter
its maximum size.

The minimum -maxmempool size is 40*-limitdescendantsize, as it is
easy for an attacker to play games with the cheapest
-limitdescendantsize transactions. -maxmempool defaults to 300MB.

This disables high-priority transaction relay when the min relay
fee adjustment is >0 (ie when the mempool is full). When the relay
fee adjustment drops below the default minimum relay fee / 2 it is
set to 0 (re-enabling priority-based free relay).
2015-10-13 01:39:27 -07:00
Matt Corallo e6c7b362ab Print mempool size in KB when adding txn 2015-10-13 01:05:43 -07:00
Matt Corallo 241d6078ba Add CFeeRate += operator 2015-10-13 01:04:39 -07:00
Matt Corallo e8bcdce8a2 Track (and define) ::minRelayTxFee in CTxMemPool 2015-10-13 01:00:19 -07:00
Matt Corallo 9c9b66f771 Fix calling mempool directly, instead of pool, in ATMP 2015-10-13 00:44:03 -07:00
Pieter Wuille 49b6fd5663 Add Mempool Expire function to remove old transactions
(note the 9x multiplier on (void*)'s for CTxMemPool::DynamicMemoryUsage
 was accidentally introduced in 5add7a7 but should have waited for this
 commit which adds the extra index)
2015-10-13 00:44:03 -07:00
Suhas Daftuar 78b82f4a16 Reverse the sort on the mempool's feerate index 2015-10-13 00:44:03 -07:00
Wladimir J. van der Laan 4e2efb3c5f tests: update transaction_tests for new dust threshold 2015-10-10 14:49:38 +02:00
Eric Lombrozo 700f52e0f6 Clarification of unit test build instructions. 2015-10-10 06:46:35 -04:00
James O'Beirne dcd8e27c65 Refer to obfuscate_key via pointer in peripheral CLevelDB classes
cc @sipa
2015-10-09 10:56:48 -07:00
James O'Beirne 1488506872 Add tests for gettxoutsetinfo, CLevelDBBatch, CLevelDBIterator
Thanks @dexX7.
2015-10-09 10:56:39 -07:00
Wladimir J. van der Laan 28e3249e53 Bump minrelaytxfee default
To bridge the time until a dynamic method for determining this fee is
merged.

This is especially aimed at the stable releases (0.10, 0.11) because
full mempool limiting, as will be in 0.12, is too invasive and risky to
backport.
2015-10-09 19:36:32 +02:00
Cory Fields 3b1279fdb2 build: match upstream build change 2015-10-09 11:38:05 +02:00
MarcoFalke 31f4ba97b7 Merge commit '313e7f5c89d6e72e06efe9255089765b4c5815fe' into HEAD 2015-10-09 11:37:00 +02:00
Wladimir J. van der Laan 6cf73b0cd4
Merge pull request #6779
b22692c build: Make use of ZMQ_CFLAGS (Cory Fields)
2015-10-09 10:26:48 +02:00
Wladimir J. van der Laan a99b6cb19e
Merge pull request #6770
b2af29b Ignore bench_bitcoin binary. (Pavel Janík)
2015-10-09 10:15:48 +02:00
James O'Beirne 0fdf8c80ee Handle obfuscation in CLevelDBIterator 2015-10-08 09:32:27 -07:00
Pieter Wuille 3499ce1e1a Encapsulate CLevelDB iterators cleanly
Conflicts:
	src/leveldb.cpp
	src/leveldb.h
	src/txdb.cpp
2015-10-08 09:32:27 -07:00
Peter Todd 65ef372302
Add BIP65 to getblockchaininfo softforks list 2015-10-08 17:37:10 +02:00
Peter Todd 287f54fc90 Add CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic
Based on the earlier BIP66 soft-fork logic implemented by Pieter
Wuille's 5a47811da5
2015-10-08 17:23:22 +02:00
Cory Fields b22692ce3e build: Make use of ZMQ_CFLAGS 2015-10-08 00:00:55 -04:00
Wladimir J. van der Laan d479311dba
Merge pull request #6720
1534d9a 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. (EthanHeilman)
2015-10-07 14:59:58 +02:00
Wladimir J. van der Laan 49dd5c629d
Merge pull request #6769
b196b68 Test LowS in standardness, removes nuisance malleability vector. (Gregory Maxwell)
2015-10-07 10:58:37 +02:00
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 a81cd96805:
 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
Philip Kaufmann e8600c924d banlist (bugfix): allow CNode::SweepBanned() to run on interval
- allows CNode::SweepBanned() to run, even if !CNode::BannedSetIsDirty(),
  because if nBanUntil is over we want the ban to be disabled for these
  nodes
2015-10-02 11:38:16 +02:00
Philip Kaufmann 2977c243ef banlist: add more banlist infos to log / add GUI signal
- to match the peers.dat handling also supply a debug.log entry for how
  many entries were loaded from banlist.dat and how long it took
- add a GUI init message for loading the banlist (same as with peers.dat)

- move the same message for peers.dat upwards in the code, to be able to
  reuse the timing variable nStart and also just log, if our read from
  peers.dat didn't fail
2015-10-02 11:38:16 +02:00
Philip Kaufmann ce479aaada banlist: better handling of banlist in StartNode()
- only start working on/with banlist data, if reading in the banlist from
  disk didn't fail
- as CNode::setBannedIsDirty is false (default) when reading fails, we
  don't need to explicitly set it to false to prevent writing
  banlist.dat in that case either
2015-10-02 11:38:15 +02:00
Philip Kaufmann 57c77fe4d3 banlist: update set dirty to be more fine grained
- move the SetBannedSetDirty(false) call from DumpData() into DumpBanlist()
- ensure we only set false, if the write succeeded
2015-10-02 11:38:14 +02:00
Luke Dashjr fd55571f06 wallet: Expose GUI labels in RPC 2015-10-02 00:21:38 +00:00
Luke Dashjr 5f9260f458 Bugfix: If genproclimit is omitted to RPC setgenerate, don't change it; also show correct default in getmininginfo 2015-10-01 23:16:42 +00:00
Luke Dashjr 420a82f1ae Bugfix: Describe dblogsize option correctly (it refers to the wallet database, not memory pool) 2015-10-01 23:16:42 +00:00
Luke Dashjr caa3d42f06 Bugfix: RPC: blockchain: Display correct defaults in help for verifychain method 2015-10-01 23:16:42 +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
Wladimir J. van der Laan a6f2affde8
Merge pull request #6565
fb08d92 Make sure we re-acquire lock if a task throws (Casey Rodarmor)
2015-08-19 16:27:40 +02:00
Wladimir J. van der Laan e08a7d9d40
Merge pull request #6561
7bd57bb Add limitedmap test (Casey Rodarmor)
8b06894 Disallow unlimited limited maps (Casey Rodarmor)
fd2d862 Make limited map actually respect max size (Casey Rodarmor)
2015-08-19 15:45:14 +02:00
Casey Rodarmor fb08d92312 Make sure we re-acquire lock if a task throws 2015-08-18 10:40:13 -04:00
Daniel Kraft 2016576998 Fix crash when mining with empty keypool.
Since the introduction of the ScriptForMining callback, the mining
functions (setgenerate and generate) crash with an assertion failure
(due to a NULL pointer script returned) if the keypool is empty.  Fix
this by giving a proper error.
2015-08-18 09:07:33 +02:00
Casey Rodarmor 7bd57bb1d7 Add limitedmap test 2015-08-17 12:15:32 -04:00
Casey Rodarmor 8b06894194 Disallow unlimited limited maps 2015-08-17 12:15:32 -04:00
Casey Rodarmor fd2d862fbc Make limited map actually respect max size 2015-08-17 12:15:32 -04:00
Wladimir J. van der Laan 39ddaeb8fe
Merge pull request #6551
243b80d Handle leveldb::DestroyDB() errors on wipe failure (Adam Weiss)
2015-08-17 16:52:57 +02:00
Jeff Garzik 6feeec1ec5
Merge pull request #6013 2015-08-15 16:09:06 -04:00
Alex Morcos bba3db1a40 Fix masking of irrelevant bits in address groups. 2015-08-14 14:25:19 -05:00
Wladimir J. van der Laan ddd8d80c63
Merge pull request #6415
d042854 SQUASH "Implement watchonly support in fundrawtransaction" (Matt Corallo)
428a898 SQUASH "Add have-pubkey distinction to ISMINE flags" (Matt Corallo)
6bdb474 Implement watchonly support in fundrawtransaction (Matt Corallo)
f5813bd Add logic to track pubkeys as watch-only, not just scripts (Matt Corallo)
d3354c5 Add have-pubkey distinction to ISMINE flags (Matt Corallo)
5c17059 Update importaddress help to push its use to script-only (Matt Corallo)
a1d7df3 Add importpubkey method to import a watch-only pubkey (Matt Corallo)
907a425 Add p2sh option to importaddress to import redeemScripts (Matt Corallo)
983d2d9 Split up importaddress into helper functions (Matt Corallo)
cfc3dd3 Also remove pay-2-pubkey from watch when adding a priv key (Matt Corallo)
2015-08-14 16:28:37 +02:00