Commit graph

6690 commits

Author SHA1 Message Date
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 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