Commit Graph

17000 Commits

Author SHA1 Message Date
practicalswift c36b720d00 Add Travis check for duplicate includes
This enforces parts of the project header include guidelines (added by @sipa in #10575).
2018-04-09 09:18:49 +02:00
practicalswift 280023f31d Remove duplicate includes 2018-04-09 09:18:49 +02:00
Wladimir J. van der Laan 4781813b56
Merge #12537: [arith_uint256] Make it safe to use "self" in operators
b120f7b [test] Add tests for self usage in arith_uint256 (Karl-Johan Alm)
08b17de [arith_uint256] Do not destroy *this content if passed-in operator may reference it (Karl-Johan Alm)

Pull request description:

  Before this fix (see test commit), `v *= v` would result in `0` because `operator*=` set `*this` (`==b`) to `0` at the start. This patch changes the code to use `a` as temporary for `*this`~~, with drawback that `*this` is set to `a` at the end, an extra `=` operation in other words~~.

Tree-SHA512: 8028a99880c3198a39c4bcc5056169735ba960625d553e15c0317510a52940c875f7a1fefe14e1af7fcf10c07a246411994a328cb1507bf3eaf1b6e7425390dc
2018-04-09 05:57:19 +02:00
Karl-Johan Alm bf08fc5b6b
test: Assert on correct variable 2018-04-09 08:51:02 +09:00
Pieter Wuille ece88fd269 Introduce BigEndian wrapper and use it for netaddress ports 2018-04-08 15:31:01 -07:00
Wladimir J. van der Laan 27278dffe8
Merge #12856: Tests: Add Metaclass for BitcoinTestFramework
c9cce0a Tests: Add Metaclass for BitcoinTestFramework (Will Ayd)

Pull request description:

  BitcoinTestFramework instructs developers in its docstring to override
  `set_test_params` and `run_test` in subclasses while being sure NOT to
  override `__init__` and `main` . This change adds a metaclass to ensure
  that developers adhere to that protocol, raising a ``TypeError`` in
  instances where they have not.

  closes #12835

Tree-SHA512: 5a47a7ead1f18361138cad4374747c4a8f29d25506f7b2c2a8c1c966a0b65e5ccf7317f9a078df8680fdab5d3fb71fee46a159c9f381878a3683c1e9f874abbe
2018-04-08 19:47:08 +02:00
MarcoFalke bd42b85e8b
Merge #12905: [rpcwallet] Clamp walletpassphrase value at 100M seconds
2b2b96cd45 Use std::bind instead of boost::bind to re-lock the wallet (Suhas Daftuar)
662d19ff72 [rpcwallet] Clamp walletpassphrase value at 100M seconds (Suhas Daftuar)

Pull request description:

  Larger values seem to trigger a bug on macos+libevent (resulting in the rpc server stopping).

Tree-SHA512: 890f3b641f6c586e2f8f629a9d23bca6ceb8b237b285561aad488cb7adf941a21177d3129d0c2b8293c0a673cd8e401957dbe2b6b3b7c8c4e991bb411d260102
2018-04-08 12:58:46 -04:00
MarcoFalke fab9095d40
qa: Windows fixups for functional tests 2018-04-08 12:44:43 -04:00
Wladimir J. van der Laan 97785863e2
Merge #12886: Introduce Span type and use it instead of FLATDATA
9272d70 Support serializing Span<unsigned char> and use that instead of FLATDATA (Pieter Wuille)
833bc08 Add Slice: a (pointer, size) array view that acts like a container (Pieter Wuille)

Pull request description:

  Introduce a new data type `Span`, which is an encapsulated pointer + size (like C++20's `std::span` or LevelDB's `Slice`), and represents a view to a sequence of objects laid out continuously in memory.

  The immediate use case is replacing the remaining `FLATDATA` invocations. Instead of those, we support serializing/deserializing unsigned char `Span`s (treating them as arrays).

  A longer term goal for `Span`s is making the script execution operate on them rather than on `CScript` itself. This will allow separate storage mechanisms for scripts.

Tree-SHA512: 7b0da3c802e5df367f223275004d16b04262804c007b7c73fda927176f0a9c3b2ef3225fa842cb73500b0df73175ec1419f1f5239de2402e21dd9ae8e5d05233
2018-04-08 18:13:49 +02:00
Wladimir J. van der Laan 15c3bb4268
Merge #12904: [qa] Ensure bitcoind processes are cleaned up when tests end
e36a0c0 [qa] Ensure bitcoind processes are cleaned up when tests end (Suhas Daftuar)

Pull request description:

  When tests fail (such as due to a bug in the test, race condition, etc), it's possible that we could follow code paths that bypass our normal node shutdown that occurs in `TestNode.stop_node`.  Add a destructor to `TestNode` that cleans this up.

Tree-SHA512: 72e04bc21462ebd0cb346fd1fe0540da454acfbad41923a0b06ea2317e9045b68e58f9adb02d8200891aca89a9d03a022eb72282aeb31a3b3afe7c6843a4b450
2018-04-08 17:40:28 +02:00
Suhas Daftuar e36a0c0852 [qa] Ensure bitcoind processes are cleaned up when tests end 2018-04-08 10:47:31 -04:00
Suhas Daftuar 2b2b96cd45 Use std::bind instead of boost::bind to re-lock the wallet
Change suggested by Marco Falke.
2018-04-08 10:44:40 -04:00
Suhas Daftuar 662d19ff72 [rpcwallet] Clamp walletpassphrase value at 100M seconds
Larger values seem to trigger a bug on macos+libevent (resulting in the
rpc server stopping).
2018-04-08 10:44:40 -04:00
Jonas Schnelli 25c56cdbe7
Merge #12878: [refactor] Config handling refactoring in preparation for network-specific sections
77a733a99 [tests] Add additional unit tests for -nofoo edge cases (Anthony Towns)
af173c2be [tests] Check GetChainName works with config entries (Anthony Towns)
fa27f1c23 [tests] Add unit tests for ReadConfigStream (Anthony Towns)
087c5d204 ReadConfigStream: assume the stream is good (Anthony Towns)
6d5815aad Separate out ReadConfigStream from ReadConfigFile (Anthony Towns)
834d30341 [tests] Add unit tests for GetChainName (Anthony Towns)
11b6b5b86 Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName (Anthony Towns)

Pull request description:

  This does a bit of refactoring of the configuration handling code in order to add additional tests to make adding support for [test]/[regtest] sections in the config file in #11862 easier. Should not cause any behaviour changes.

Tree-SHA512: 8d2ce1449fc180de03414e7e569d1a21ba1e9f6564e13d3faf3961f710adc725fa0d4ab49b89ebd2baa11ea36ac5018377f693a84037d386a8b8697c9d6db3e9
2018-04-08 16:24:30 +02:00
MarcoFalke 7e23972d1f
Merge #12901: build: Show enabled sanitizers in configure output
01189ab9ae build: Show enabled sanitizers in configure output (practicalswift)

Pull request description:

  Show enabled sanitizers in `configure` output.

  Context: @eklitzke excellent addition of `--with-sanitizers` in #12692

Tree-SHA512: b2d52308e3476488fe47cbc059d7f3235aaeefaa2b987003923f6eaacbadf67f0cf22a32a04873d0f54c1867757841e01c8053f86a4d2f59a407b960ac15105f
2018-04-08 09:51:39 -04:00
Wladimir J. van der Laan 24133b177a
Merge #12561: Check for block corruption in ConnectBlock()
0e7c52d Shut down if trying to connect a corrupted block (Suhas Daftuar)

Pull request description:

  (Updated OP after reworking the approach)

  Shut down if a corrupted block is found in ConnectBlock().  This prevents an infinite loop trying to connect such a block, and alerts the node operator that there may be potential hardware failure.

Tree-SHA512: f20d56aa9d36d6eeff4c3d13c0fbd14f06a57701bd13c2416d36f0cc4235f81f752139e336a073617e8e803782c5096c960108af122b19a51227de512e9095ee
2018-04-08 11:08:43 +02:00
Wladimir J. van der Laan 3190785c11
Merge #12891: [logging] add lint-logs.sh to check for newline termination.
d207207 [logging] add lint-logs.sh to check for newline termination. (John Newbery)
5c21e6c [logging] Comment all continuing logs. (John Newbery)

Pull request description:

  Check that all calls to LogPrintf() are terminated by a newline,
  except those that are explicitly marked as 'continued' logs.

Tree-SHA512: fe5162b2b2df1e8a4c807da87584fa9af97a6b8377e4090fe0caa136d90bf29a487a123cde94569bdce7101fee3478196d99aa13f1212e24bfe5f41c773604fc
2018-04-08 11:04:49 +02:00
Wladimir J. van der Laan d6f10b248a
Merge #12895: tests: Add note about test suite name uniqueness requirement to developer notes
d1b622b tests: Add check for test suite name uniqueness in lint-tests.sh (practicalswift)
dc8067b tests: Add note about uniqueness requirement for test suite names (practicalswift)
3ebfb2d tests: Avoid test suite name collision in wallet crypto_tests (MarcoFalke)

Pull request description:

  * Add documentation: Add note about test suite name uniqueness requirement in developer notes
  * Add regression test: Update `lint-tests.sh` to make it check also for test suite name uniqueness

  Context: #12894 (`tests: Avoid test suite name collision in wallet crypto_tests`)

Tree-SHA512: 3c8502db069ef3d753f534976a86a997b12bac539e808a7285193bf81c9dd8c1b06821c3dd1bdf870ab87722b02c8aa9574c62ace70c2a1b8091785cb8c9aace
2018-04-08 10:47:35 +02:00
fivepiece 41ff9675a9 list the types of scripts we should consider for a witness program 2018-04-08 00:03:04 +03:00
MarcoFalke 048ac8326b
Merge #12906: Avoid `interface` keyword to fix windows gitian build
17780d6f35 scripted-diff: Avoid `interface` keyword to fix windows gitian build (Russell Yanofsky)

Pull request description:

  Rename `interface` to `interfaces`

  Build failure reported by ken2812221 in https://github.com/bitcoin/bitcoin/pull/10244#issuecomment-379434756

Tree-SHA512: e02c97c728540f344202c13b036f9f63af23bd25e25ed7a5cfe9e2c2f201a12ff232cc94a93fbe37ef6fb6bf9e036fe62210ba798ecd30de191d09338754a8d0
2018-04-07 15:19:47 -04:00
Wladimir J. van der Laan becd8dd2ec
Merge #12618: Set SCHED_BATCH priority on the loadblk thread.
d54874d Set SCHED_BATCH priority on the loadblk thread. (Evan Klitzke)

Pull request description:

  Today I came across #10271, and while reading the discussion #6358 was linked to. Linux systems have a `SCHED_BATCH` scheduler priority that is useful for threads like loadblk. You can find the full details at [sched(7)](http://man7.org/linux/man-pages/man7/sched.7.html), but I'll quote the relevant part of the man page below:

  > ...this policy will cause the scheduler to always assume that the thread is
  CPU-intensive. Consequently, the scheduler will apply a small scheduling penalty
  with respect to wakeup behavior, so that this thread is mildly disfavored in
  scheduling decisions.
  >
  > This policy is useful for workloads that are noninteractive, but do not want to
  lower their nice value, and for workloads that want a deterministic scheduling
  policy without interactivity causing extra preemptions (between the workload's
  tasks).

  I think this change is useful independently of #10271 and irrespective of whether that change is merged. Under normal operation the loadblk thread will just import `mempool.dat`. However, if Bitcoin is started with `-reindex` or `-reindex-chainstate` this thread will use a great deal of CPU while it rebuilds the chainstate database (and the block database in the case of `-reindex`). By setting `SCHED_BATCH` this thread is less likely to interfere with interactive tasks (e.g. the user's web browser, text editor, etc.).

  I'm leaving the nice value unchanged (which also affects scheduling decisions) because I think that's better set by the user. Likewise I'm not using [ioprio_set(2)](http://man7.org/linux/man-pages/man2/ioprio_set.2.html) because it can cause the thread to become completely I/O starved (and knowledgeable users can use `ionice(1)` anyway).

Tree-SHA512: ea8f7d3921ed5708948809da771345cdc33efd7ba3323e9dfec07a25bc21e8612e2676f9c178e2710c7bc437e8c9cafc5e0463613688fea5699b6e8e2fec6cff
2018-04-07 19:48:39 +02:00
Russell Yanofsky 9b0f0c5513 Add m_ prefix to WalletBatch::m_batch 2018-04-07 12:48:27 -04:00
Wladimir J. van der Laan b2e5fe8b55
Merge #12708: Make verify-commits.sh test that merges are clean
577f111 Make verify-commits.sh test that merges are clean (Pieter Wuille)

Pull request description:

  Unsure if we want this.

  This modifies verify-commits.sh to redo all merges along the leftmost commit branch (which includes all PR merges), and verify whether they match the merge commit's trees.

  The benefit is that it will detect a case where one of the maintainers merges a PR, but makes an unrelated change inside the merge commit. This on itself is not very strong, as unrelated changes can also be included in the merged branch itself - but perhaps the merge commit is not something that people are otherwise likely to look at.

  Fixes #8089

Tree-SHA512: 2c020f5ac3f771ac775aa726832916bb8e03a311b2745d7a9825047239bd0660d838f086f3456f2bb05cea14c1529f74436b8cdd74cc94b70e40b4617309f62c
2018-04-07 18:48:27 +02:00
Russell Yanofsky 398c6f0f9d Update walletdb comment after renaming.
Text from https://github.com/bitcoin/bitcoin/pull/11851#issuecomment-350320608
by John Newbery <john@johnnewbery.com>.
2018-04-07 11:48:27 -05:00
Russell Yanofsky ea23945dbc scripted-diff: Rename wallet database classes
-BEGIN VERIFY SCRIPT-

sed -i 's/\<CWalletDBWrapper\>/BerkeleyDatabase/g' src/wallet/db.h src/wallet/db.cpp
sed -i '/statuses/i/** Backend-agnostic database type. */\nusing WalletDatabase = BerkeleyDatabase\;\n' src/wallet/walletdb.h
ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' ':(exclude)*dbwrapper*' test | xargs sed -i "s:\<$1\>:$2:g"; }
ren CDBEnv           BerkeleyEnvironment
ren CDB              BerkeleyBatch
ren CWalletDBWrapper WalletDatabase
ren CWalletDB        WalletBatch
ren dbw              database
ren m_dbw            m_database
ren walletdb         batch
ren pwalletdb        batch
ren pwalletdbIn      batch_in
ren wallet/batch.h   wallet/walletdb.h
ren pwalletdbEncryption encrypted_batch

-END VERIFY SCRIPT-
2018-04-07 11:48:27 -05:00
Wladimir J. van der Laan f8d6dc47cb
Merge #12860: Add testmempoolaccept to release-notes, Add missing const
fafcad3 doc: Add testmempoolaccept to release-notes (MarcoFalke)

Pull request description:

  Some fixups for #11742:

  * Add release notes for the new rpc
  * Fix a typo in the original pull
  * Make the mempool reference passed to `CheckInputsFromMempoolAndCache` const, since that function is called before we return from ATMP and we must not modify the mempool.

Tree-SHA512: 72c459ba69f7698a69c91d2592f10f7fb1864846c7d8c525050d48286f92ba5ec5fe554c54235b52fbd9a8f00226c526ad84584641ec39084e1a1310a261510d
2018-04-07 18:43:39 +02:00
John Newbery d207207fd3 [logging] add lint-logs.sh to check for newline termination.
Check that all calls to LogPrintf() are terminated by a newline,
except those that are explicitly marked as 'continued' logs.
2018-04-07 12:29:52 -04:00
John Newbery 5c21e6c6d3 [logging] Comment all continuing logs.
Most logs should terminated with a '\n'. Some logs
are built up over multiple calls to logPrintf(), so
do not need a newline terminater. Comment all of
these 'continued' logs as a linter hing.
2018-04-07 12:29:48 -04:00
Wladimir J. van der Laan 319991db5b
Merge #12850: doc: add qrencode to brew install instructions
0314ad4 doc: add qrencode to brew install instructions (buddilla)

Pull request description:

  Build was missing qr code(qrencode libs) support and brew team no longer supports anything less than macOS 10.11

Tree-SHA512: 1bc22f02e64f0db0730180ca97fba17c7ad05c9d81c60d1b0d029196d5141e691e524d2df2be1fb89852076f3a252da69bb117042cbd08985b89954432692529
2018-04-07 17:04:45 +02:00
buddilla 0314ad4e6d doc: add qrencode to brew install instructions
Build was missing qr code(qrencode libs) support
2018-04-07 16:59:49 +02:00
Wladimir J. van der Laan b15485ecca
Merge #12896: docs: Fix conflicting statements about initialization in developer notes
b119e78 docs: Fix conflicting statements about initialization in developer notes (practicalswift)

Pull request description:

  Fix conflicting statements about initialization in developer notes.

  Context: https://github.com/bitcoin/bitcoin/pull/12785#issuecomment-378941151

Tree-SHA512: 601b18cbeb963f99a4180e652d6c1b78210df89743fd3565c0bce95fd2dcc9784b6af212795a43d3a40a5858b1a03e0d2c7982295c92d6ea710db0e6ee69f0b4
2018-04-07 16:44:28 +02:00
Wladimir J. van der Laan 215158a633
Merge #12785: wallet: Initialize m_last_block_processed to nullptr
f63bc5e wallet: Initialize m_last_block_processed to nullptr. Initialize fields where defined. (practicalswift)

Pull request description:

  Initialize `m_last_block_processed` to `nullptr`.

  `m_last_block_processed` was introduced in 5ee3172636.

Tree-SHA512: 6e4a807e5b02115cbd80460761056f2eb22043203212d88dd0cd44c28dc0abce30ab29b078ca2c612232e76af4886f4fdbf2b0ff75e2df19b4d1a801b236cc13
2018-04-07 16:40:08 +02:00
MarcoFalke 83c7533eb1
Merge #12849: Tests: Add logging in loops in p2p_sendhears.py
8dd547d82b Adding logging for loop iteration level in p2p_sendheaders.py (ccdle12)

Pull request description:

  PR for #12453

  New contributor looking at mainly the 'good first issues'.

  From my understanding of the issue:
   * Track the iteration level of loop when test fails in Travis CI

  Further clarification on the issue would be greatly appreciated to narrow down what can be fixed or updated.

Tree-SHA512: 228524aad54c09979d990a0fc6818e13a11e1ab5e78b606b892e897bba7b1e09bf25447feb631049e45ac017eeb61fbf1c1f11e8bd5103648f976a05099ba9f9
2018-04-07 10:33:55 -04:00
Wladimir J. van der Laan 69310a342f
Merge #12766: [Tests] Tidy up REST interface functional tests
55efc1f [tests] simplify binary and hex response parsing in interface_rest.py (Roman Zeyde)
ade5964 [tests] only use 2 nodes in interface_rest.py (John Newbery)
ad00fbe [tests] refactor interface_rest.py to avoid code repetition (John Newbery)
7a3181a [tests] Make json request building more consistent in interface_rest.py (John Newbery)
3fd4490 [tests] improve logging and documentation in interface_rest.py (John Newbery)
abf190e [tests] fix flake8 warnings in interface_rest.py test (John Newbery)

Pull request description:

  Following the comment at https://github.com/bitcoin/bitcoin/pull/12717#pullrequestreview-106189117.

Tree-SHA512: b55560f0d8f3069584f5a2398285483a0a23514b2b2bd2c1ced2db1cb30dc24f60f720d0fa4de30259f7918d3178d94680ae9321649544d1d04d687a2e672559
2018-04-07 16:15:35 +02:00
Wladimir J. van der Laan 9abdb7c67e
Merge #12836: Make WalletInitInterface and DummyWalletInit private, fix nullptr deref
d894894 wallet: Refactor to WalletInitInterface* const g_wallet_init_interface (João Barbosa)
39bc2fa wallet: Make WalletInitInterface and DummyWalletInit private (João Barbosa)

Pull request description:

  Implementations of `WalletInitInterface` don't have to be public, so make them private. This makes the interface instantiation static. Also reduces `ENABLE_WALLET` usage and removes the unnecessary `src/wallet/init.h` header.

Tree-SHA512: 203c49d8c85252d1bd0ff1d7ed8bcdc842d12d2d396e965cc70be5c8159a62e98ec23d32d2f3dc48a53e575844130d0a7dedac3cc2fe4621d31319b7a1c9ba89
2018-04-07 13:54:09 +02:00
Russell Yanofsky 17780d6f35 scripted-diff: Avoid `interface` keyword to fix windows gitian build
Rename `interface` to `interfaces`

Build failure reported by Chun Kuan Lee <ken2812221@gmail.com>
https://github.com/bitcoin/bitcoin/pull/10244#issuecomment-379434756

-BEGIN VERIFY SCRIPT-

git mv src/interface src/interfaces
ren() { git grep -l "$1" | xargs sed -i "s,$1,$2,g"; }
ren interface/            interfaces/
ren interface::           interfaces::
ren BITCOIN_INTERFACE_    BITCOIN_INTERFACES_
ren "namespace interface" "namespace interfaces"

-END VERIFY SCRIPT-
2018-04-07 03:42:02 -04:00
251 09b30db2b0 Asserts that the tx version number is a signed 32-bit integer. 2018-04-06 21:47:29 +02:00
practicalswift d1b622b5a2 tests: Add check for test suite name uniqueness in lint-tests.sh 2018-04-06 16:29:14 +02:00
practicalswift dc8067b3e6 tests: Add note about uniqueness requirement for test suite names 2018-04-06 16:29:14 +02:00
MarcoFalke 3ebfb2dadb tests: Avoid test suite name collision in wallet crypto_tests 2018-04-06 16:29:14 +02:00
practicalswift 01189ab9ae build: Show enabled sanitizers in configure output 2018-04-06 11:08:20 +02:00
practicalswift b119e78733 docs: Fix conflicting statements about initialization in developer notes 2018-04-05 23:25:07 +02:00
João Barbosa d894894aab wallet: Refactor to WalletInitInterface* const g_wallet_init_interface 2018-04-05 21:09:22 +01:00
João Barbosa 39bc2faa2e wallet: Make WalletInitInterface and DummyWalletInit private 2018-04-05 21:09:21 +01:00
Anthony Towns 77a733a99a [tests] Add additional unit tests for -nofoo edge cases 2018-04-06 04:46:39 +10:00
Anthony Towns af173c2bec [tests] Check GetChainName works with config entries 2018-04-06 04:46:32 +10:00
Anthony Towns fa27f1c23e [tests] Add unit tests for ReadConfigStream 2018-04-06 04:46:32 +10:00
Anthony Towns 087c5d2040 ReadConfigStream: assume the stream is good 2018-04-06 04:46:32 +10:00
Anthony Towns 6d5815aad0 Separate out ReadConfigStream from ReadConfigFile 2018-04-06 04:46:32 +10:00
Anthony Towns 834d303415 [tests] Add unit tests for GetChainName 2018-04-06 04:46:23 +10:00