Commit graph

16947 commits

Author SHA1 Message Date
John Newbery
2bff472992 [contrib] convert test-security-check to python3 2018-04-14 02:13:42 +08:00
practicalswift
958bf40489 add lint tool to check python3 shebang 2018-04-14 02:13:24 +08:00
Wladimir J. van der Laan
23e7fe8be8
Merge #12569: net: Increase signal-to-noise ratio in debug.log by adjusting log level when logging failed non-manual connect():s
cba2800 Increase signal-to-noise ratio in debug.log by adjusting log level when logging failed non-manual connect():s (practicalswift)

Pull request description:

  Increase signal-to-noise ratio in `debug.log` by adjusting log level when logging failed non-manual `connect()`:s.

  Before this patch:

  ```
  $ src/bitcoind -printtoconsole
  …
  2018-02-28 18:42:51 UpdateTip: new best=0000000000005448b10a219683d34b770a28044e1cc421032dea1a79ff548948 height=1286903 version=0x20000000 log2_work=69.791313 tx=17408546 date='2018-02-28 18:42:46' progress=1.000000 cache=0.0MiB(173txo)
  2018-02-28 18:37:52 connect() 10.11.21.34:18333 failed after select(): Connection refused (111)
  2018-02-28 18:43:22 connect() to 10.11.43.14:18333 failed after select(): Network is unreachable (101)
  2018-02-28 18:44:49 UpdateTip: new best=000000000000029a521ff2803e1441b09413b876accff5084a4cccf7747d798b height=1286904 version=0x20000000 log2_work=69.791345 tx=17408559 date='2018-02-28 18:44:51' progress=1.000000 cache=0.1MiB(502txo)
  2018-02-28 18:46:54 connect() to [2001:0:9d38:78ff:1234🔢1234:1234]:18333 failed: Network is unreachable (101)
  2018-02-28 18:48:56 connect() to [2001:0:9d38:6aff:1234🔢1234:1234]:18333 failed: Network is unreachable (101)
  2018-02-28 18:49:11 UpdateTip: new best=000000000000000206b79eb235e5dd907b6369de0e5d764330bf40ec0d460311 height=1286905 version=0x20000000 log2_work=69.791377 tx=17408577 date='2018-02-28 18:49:12' progress=1.000000 cache=1.0MiB(5245txo)
  ```

  After this patch:

  ```
  $ src/bitcoind -printtoconsole
  …
  2018-02-28 18:42:51 UpdateTip: new best=0000000000005448b10a219683d34b770a28044e1cc421032dea1a79ff548948 height=1286903 version=0x20000000 log2_work=69.791313 tx=17408546 date='2018-02-28 18:42:46' progress=1.000000 cache=0.0MiB(173txo)
  2018-02-28 18:44:49 UpdateTip: new best=000000000000029a521ff2803e1441b09413b876accff5084a4cccf7747d798b height=1286904 version=0x20000000 log2_work=69.791345 tx=17408559 date='2018-02-28 18:44:51' progress=1.000000 cache=0.1MiB(502txo)
  2018-02-28 18:49:11 UpdateTip: new best=000000000000000206b79eb235e5dd907b6369de0e5d764330bf40ec0d460311 height=1286905 version=0x20000000 log2_work=69.791377 tx=17408577 date='2018-02-28 18:49:12' progress=1.000000 cache=1.0MiB(5245txo)
  ```

  Please note that "manual `connect()`:s" (invoked via `-connect`, `-proxy` or `addnode`) are still reported at the default log level as these messages are likely to be relevant to end-users:

  ```
  $ src/bitcoind -printtoconsole -connect=127.0.0.1:1234
  …
  2018-02-28 18:31:13 connect() to 127.0.0.1:1234 failed after select(): Connection refused (111)

  $ src/bitcoind -printtoconsole -proxy=127.0.0.1:1234
  …
  2018-02-28 18:32:32 connect() to 127.0.0.1:1234 failed after select(): Connection refused (111)

  $ src/bitcoind -printtoconsole &
  $ src/bitcoin-cli addnode 127.0.0.1:1234 onetry
  …
  2018-02-28 18:33:40 connect() to 127.0.0.1:1234 failed after select(): Connection refused (111)
  ```

Tree-SHA512: 92e3c1e4b54ce8ccdd7ec31de147c8505710cd799ceb2bbc8576a086709967802403c9184df364b3cfa59bd98859f6ac8feb27fb09b9324194c6c47a042fc6d3
2018-04-13 19:25:18 +02:00
Pieter Wuille
54a5a21158 [MOVEONLY] Turn CScript::GetOp2 into a function and move to cpp 2018-04-13 09:07:29 -07:00
Pieter Wuille
6a7456ad60 [MOVEONLY] Move CSCript::FindAndDelete to interpreter 2018-04-13 09:07:27 -07:00
Pieter Wuille
33a8ecfbce Delete unused non-const-iterator CSCript::GetOp overloads 2018-04-13 09:06:35 -07:00
Pieter Wuille
2fb168b55d Make iterators in CScript::FindAndDelete const 2018-04-13 09:06:35 -07:00
Wladimir J. van der Laan
e625548e7c
Merge #12950: bitcoin-tx: Flatten for loop over one element
fa72f34 bitcoin-tx: Remove unused for loop (MarcoFalke)

Pull request description:

  This flattens out a for loop and gets rid of the then unused vector `txVariants`.

Tree-SHA512: 68081b313d846ce235a97a642c9d0097c3641350e819d6254001f332b053e41fa63ce49faca68120f5aaf5d5f4bfda104662eae781e2956d76a8915770344045
2018-04-13 17:15:15 +02:00
Suhas Daftuar
8b56fc0b91 [qa] Test that v0 segwit outputs can't be spent pre-activation
Also updates the comments for an existing test, that now should be rewritten.
Includes changes suggested by John Newbery.
2018-04-13 10:35:27 -04:00
Suhas Daftuar
ccb8ca42a4 Always enforce SCRIPT_VERIFY_WITNESS with P2SH 2018-04-13 10:35:27 -04:00
Suhas Daftuar
5c31b20a35 [qa] Remove some pre-activation segwit tests
This is in preparation for always enforcing SCRIPT_VERIFY_WITNESS.
2018-04-13 10:35:27 -04:00
Suhas Daftuar
95749a5836 Separate NULLDUMMY enforcement from SEGWIT enforcement
This is in preparation for enforcing SCRIPT_VERIFY_WITNESS from
the genesis block.
2018-04-13 10:35:27 -04:00
Suhas Daftuar
ce650182f4 Use P2SH consensus rules for all blocks
This commit moves P2SH activation back to the genesis block, with
a hardcoded exception for the one historical block in the chain that
violated this rule.
2018-04-13 09:52:50 -04:00
Wladimir J. van der Laan
94deb09349
Merge #12969: Drop dead code CScript::Find
8cbc5c4 Drop dead code CScript::Find (Ben Woosley)

Pull request description:

  Last use removed in 922e8e2 (2012!)

Tree-SHA512: d62daf2fc340a04c5f68990aa450d6738fadf4df6c50507fe02ecb62ae329b77db401719bf556a69f747408efdea5bc98af5e41ba82650b2f6d8b2d5489625e4
2018-04-13 15:09:04 +02:00
João Barbosa
6ec78f1461 wallet: Refactor g_wallet_init_interface to const reference 2018-04-13 14:07:21 +01:00
João Barbosa
1936125671 wallet: Make WalletInitInterface members const 2018-04-13 14:02:59 +01:00
Wladimir J. van der Laan
e87fefc60f test: Add rpc_bind test to default-run tests
Skip the parts that cannot be run on the host due to lack
of IPv6 support or a second interface to bind on, and warn
appropriately.

Without no strong requirements (besides being Linux only, in which case
the test is skipped) left, just add this test to the default in
test_runner.

Includes suggested changes by John Newbery.
2018-04-13 14:40:05 +02:00
Pieter Wuille
1527015681 Avoid std::locale/imbue in DateTimeStrFormat 2018-04-13 01:36:53 -07:00
Ben Woosley
8cbc5c4be4
Drop dead code CScript::Find
Last use removed in 922e8e2929 (2012!)
2018-04-12 18:57:23 -07:00
Pieter Wuille
5df84de583
Merge #12970: logging: bypass timestamp formatting when not logging
339730a6d8 logging: bypass timestamp formatting when not logging (Cory Fields)

Pull request description:

  As suggested by @laanwj on IRC:
  ```
  <cfields> whoa
  <cfields> Leaving test case "knapsack_solver_test"; testing time: 358694ms
  <cfields> i386 + old wine ^^
  <cfields> Leaving test case "knapsack_solver_test"; testing time: 6781ms
  <cfields> ^^ same, but with the LogPrint commented out
  ...
  <wumpus> if both log-to-file and log-to-console is disabled, it should probably bypass all logging
  ```
  Edit: The painful line commented out being the LogPrintf in CWallet::AddToWallet.

Tree-SHA512: bc6da67dcdf05e9164fff7a7e9980de897e6f1b0d3f6e1ebde2162cbcba7d54a6ec94283534eb5a1ebde7134533d7fe7e496aa35ea3128c567ed6483eae5212c
2018-04-12 18:35:26 -07:00
Akio Nakamura
2eb5036c33 macOS: Prevent Xcode 9.3 build warnings
This PR solves #12867 (needs to run autogen.sh && ./configure)

clang (Apple LLVM version 9.1.0 (clang-902.0.39.1)) warns unused
argument '-pie' during compilation.
So we check for warnings in the test using $CXXFLAG_WERROR.

Windows is alse default-pie and was special-cased because it also
warned, but we can also eliminate that case if warnings are caught.
2018-04-13 10:26:05 +09:00
Pieter Wuille
4ba6da5574
Merge #12743: Fix csBestBlock/cvBlockChange waiting in rpc/mining
4a6c0e3dcf Modernize best block mutex/cv/hash variable naming (Pieter Wuille)
45dd135039 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille)

Pull request description:

  This is an alternative to #11694.

  It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.

  Also rename the involved variable to modern guidelines, as there are very few uses.

Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
2018-04-12 18:25:44 -07:00
Cory Fields
339730a6d8 logging: bypass timestamp formatting when not logging
This leads to massive speedups under Wine.
2018-04-12 18:33:30 -04:00
Andrew Chow
ae1d2b0308 Give an error when rescan is aborted by the user 2018-04-12 17:00:34 -04:00
Andrew Chow
69b01e6f8b Add cancel button to rescan progress dialog
Adds a cancel button to the rescan progress dialog. When it is clicked,
AbortRescan is called to abort a rescan
2018-04-12 17:00:30 -04:00
Wladimir J. van der Laan
8480d41e0f
Merge #12803: Make BaseSignatureCreator a pure interface
be67831 Make DummySignatureCreator a singleton (Pieter Wuille)
190b8d2 Make BaseSignatureCreator a pure interface (Pieter Wuille)

Pull request description:

  * Removes the `m_provider` field from `BaseSignatureCreator`. Instead both a `SigningProvider` (which provides keys and scripts) and a `BaseSignatureCreator` (which implements the transaction-specific (or other) signing logic) are passed into and down in `ProduceSignature`, making the two concepts orthogonal.
  * Makes `BaseSignatureCreator` a pure interface without constructor, making it easier to implement new derivations of it (for example for message signing).
  * As `DummySignatureCreator` now becomes a stateless object, turn it into a singleton `DUMMY_SIGNATURE_CREATOR`.

Tree-SHA512: 5f1f4512e4ea7d02a31df7b9ede55008efa716c5b74a2630ca1c2fc6599584d8bf5f5641487266127f4b3788033803539fbd22b03ef1219c83c10da2d3da3dcd
2018-04-12 22:55:56 +02:00
Wladimir J. van der Laan
39439e5ab4
Merge #12888: debug log number of unknown wallet records on load
72ec5b7 debug log number of unknown wallet records on load (Gregory Sanders)

Pull request description:

  This would have saved me some time during wallet debugging, with minimal logging clutter.

Tree-SHA512: e11a4d73a5b1d2bd73fe7b75b62fdfa127e21b8641c5b0c76f14ecd292ab374c0d4749f6bd99919b2b3e9cb00c3b5e8179386eb39ac656698306b3b545ee79f1
2018-04-12 09:17:45 +02:00
Wladimir J. van der Laan
e561cf4fa8
Merge #12939: Extract consts for WITNESS_V0 hash sizes
3450a9b Extract consts for WITNESS_V0 hash sizes (Ben Woosley)

Pull request description:

Tree-SHA512: 57ba84dfa36aa61cabffce747388143cf1c8724dd2fc42aecf93748158b75dbe278b21a32483a100b8c303f6ad01d048da03b0a5c172175febbe70938ed4339d
2018-04-12 08:36:26 +02:00
MarcoFalke
979f59850c
Merge #12947: Wallet hd functional test speedup and clarification
6cba60ace2 speed up wallet_hd.py and clarify/augment checks (Gregory Sanders)

Pull request description:

  With `keypool=0` I see no reason to do 300 addresses and sends.

  (with --enable-debug)

  Before patch:
  real	1m10.412s
  user	0m49.772s
  sys	0m3.988s

  After:
  real	0m11.566s
  user	0m3.344s
  sys	0m4.648s

  Also added check, since I failed to understand that on startup the wallet already knows about funds by rescanning blocks newer than oldest key birthdate.

Tree-SHA512: cf90f7fe6a437b8b7b1f0707464b9c06085233167826f1a12c3871684664d4d572e13f03e13a718e4537cac39713271c4ac3d9b983e10080b50647caf3cbe82d
2018-04-11 17:11:15 -04:00
James O'Beirne
0ef7b403d0 [doc] Fix comment in FindForkInGlobalIndex
The comment erroneously implies that we're searching `chainActive` for the
first block common to `locator`, but we're using the parameter `chain`.
2018-04-11 15:56:37 -04:00
MarcoFalke
7c06171b3d
Merge #12837: rpc: fix type mistmatch in listreceivedbyaddress
05c03d1249 rpc: fix type mistmatch in listreceivedbyaddress (joemphilips)

Pull request description:

  `txids` filed in return value is supposed be `string` but it was `numeric` in the help message

Tree-SHA512: 7d860994c2d1d9149b41fd7afefc1a44460eede5a023070fcc18b0a4a19a26c5eec5abd157038c15fe7d50a3390bdaf7a4823279129eb1458b0d3c6141a533ee
2018-04-11 15:32:55 -04:00
MarcoFalke
fae58eca93
tests: Avoid copies of CTransaction 2018-04-11 14:59:53 -04:00
MarcoFalke
fa72f34c64
bitcoin-tx: Remove unused for loop 2018-04-11 14:12:40 -04:00
Gregory Sanders
6cba60ace2 speed up wallet_hd.py and clarify/augment checks 2018-04-11 11:49:37 -04:00
Gregory Sanders
72ec5b7766 debug log number of unknown wallet records on load 2018-04-11 11:46:14 -04:00
fanquake
5b4fc3eca4 depends: Fix Qt build with XCode 9.3 2018-04-11 22:55:18 +08:00
MarcoFalke
3cf76c23fb
Merge #12933: doc: Refine header include policy
fad0fc3c9a Refine travis check for duplicate includes (MarcoFalke)

Pull request description:

  Since there is no harm in having "duplicate" includes and it makes it obvious what are the dependencies of each file, without having to do static analysis or jumping between files, I'd suggest to revert the travis check for duplicate includes.

  Generally, I think that enforcing minor style preferences should not be done via travis. The cost of maintaining and the burden on other developers is too high. C.f discussion in https://github.com/bitcoin/bitcoin/pull/10973#discussion_r180142594

Tree-SHA512: 97ab0e769d457ccfb873fff6c99613f8b944cd7ef95bfdccb0e1bbe8f5df1f16548c658fa03af42516f806546e75646d338a061e7b057619490235d311ca21f1
2018-04-11 10:45:47 -04:00
Wladimir J. van der Laan
6d3de17a22
Merge #12925: wallet: Logprint the start of a rescan
cab0824 Logprint the start of a rescan (Jonas Schnelli)

Pull request description:

  Right now, there is no log entry when a rescan starts which is confusing especially when a "still rescanning" log entry appears after the log-update timeout of 60s or when user manually aborts the rescan.

  This PR adds a log entry when a rescan starts.

Tree-SHA512: 8712605af6fd60950bf3904cfb586da6022e44b3da6f3155fe4f02aae16df6044bc504b3d48945ea6d7fe768f0c6cb3282a2e2251d14bf3b7f1dcbd12568b05e
2018-04-11 16:21:10 +02:00
MarcoFalke
fb17faefb8
Merge #12871: Add shell script linting: Check for shellcheck warnings in shell scripts
1499fdc350 Add shell script linting: Check for shellcheck warnings in shell scripts (practicalswift)

Pull request description:

  Add shell script linting: Check for `shellcheck` warnings in shell scripts.

Tree-SHA512: c7f3f5ed9933415666d2a02f5658cdc62b959ce8112f46b6327ff5f77bb5a66710704c0cde5fd8e719d1fa1fc4f0375a0c115faced166b78e81b75dfb862f08e
2018-04-11 10:01:42 -04:00
Wladimir J. van der Laan
fefb817009
Merge #12942: rpc: Drop redundant testing of signrawtransaction prevtxs args
459ea58 rpc: Drop redundant testing of signrawtransaction prevtxs args (Ben Woosley)

Pull request description:

  These other types are already tested on line 736.

Tree-SHA512: 2efe777c8a63c69ffe0fafcb2f37f134d324a8bc9525510f1079d2215535b511d6308e5e6eec702a3444f87701236c5e7a22f10bb24e5a454010ef421e5ae900
2018-04-11 15:57:41 +02:00
practicalswift
1499fdc350 Add shell script linting: Check for shellcheck warnings in shell scripts 2018-04-11 15:41:18 +02:00
Wladimir J. van der Laan
1b5723ee57
Merge #11617: Avoid lock: Call FlushStateToDisk(...) regardless of fCheckForPruning
0000d8f Document how FlushStateMode::NONE is handled (practicalswift)
2311c7c Call FlushStateToDisk(...) regardless of fCheckForPruning (practicalswift)

Pull request description:

  FlushStateToDisk(...) won't do anything besides check if we need to prune if
  FLUSH_STATE_NONE is given. We avoid reading the variable fCheckForPruning
  which is guarded by the mutex cs_LastBlockFile.

Tree-SHA512: 89df06256f73503a74b9e26d580ce9ed09efaef347fae1ff6a5759a2993b0db52edd2fadb65694d27e579a5aed92127753bdf41b5bb1bd516e577fcf17f17999
2018-04-11 15:29:21 +02:00
Anthony Towns
c25321ff96 Add config changes to release notes 2018-04-11 23:15:28 +10:00
Anthony Towns
5e3cbe020d [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections 2018-04-11 23:15:28 +10:00
Anthony Towns
005ad26649 ArgsManager: special handling for -regtest and -testnet 2018-04-11 23:15:28 +10:00
Anthony Towns
608415d4e6 [tests] Unit tests for network-specific config entries 2018-04-11 23:15:28 +10:00
Anthony Towns
68797e20f4 ArgsManager: Warn when ignoring network-specific config setting
When network-specific options such as -addnode, -connect, etc are
specified in the default section of the config file, but that setting is
ignored due to testnet or regtest being in use, and it is not overridden
by either a command line option or a setting in the [regtest] or [test]
section of the config file, a warning is added to the log, eg:

  Warning: Config setting for -connect only applied on regtest network when in [regtest] section.
2018-04-11 23:15:28 +10:00
Anthony Towns
d1fc4d95af ArgsManager: limit some options to only apply on mainnet when in default section
When specified in bitcoin.conf without using the [regtest] or [test]
section header, or a "regtest." or "test." prefix, the "addnode",
"connect", "port", "bind", "rpcport", "rpcbind", and "wallet" settings
will only be applied when running on mainnet.
2018-04-11 23:15:28 +10:00
Anthony Towns
8a9817d175 [tests] Use regtest section in functional tests configs 2018-04-11 23:15:28 +10:00
Anthony Towns
30f94074c8 [tests] Unit tests for config file sections 2018-04-11 23:15:28 +10:00