Commit Graph

16909 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 84efa9a0f7
Merge #12448: Interrupt block generation on shutdown request
0851a75 rpc: Interrupt block generation on shutdown request (João Barbosa)

Pull request description:

  With this simple change, after running `bitcoin-cli -regtest generate 100000`, it is possible to interrupt `bitcoind` cleanly without waiting for the generation to complete.

Tree-SHA512: f0f7cdde242e595cfdaea31ae8bddbc25933621b63f639e813d272c2b00ce2ef52f0c14ae44954ba8c49f0fc846bcc3bfd5419e52b3347a68bb0341ce6b02d26
2018-04-23 18:04:52 +02:00
Wladimir J. van der Laan d1e3c5e73c
Merge #13012: [doc] Add comments for chainparams.h, validation.cpp
18326ae [doc] Add comments for chainparams.h, validation.cpp (James O'Beirne)

Pull request description:

  Added a few comments during a leisurely read through some of the validation code. If this kind of thing seems useful, I can add similar documentation for most of the `CChainState` interface.

Tree-SHA512: a4d9db60383a8ff02e74ac326ed88902eec1ee441e8cd4e1845bcf257072673c15974225288cebf0a633e76a3410f99e2206616b4694725a2a5b0d19c78327d6
2018-04-23 17:15:33 +02:00
MarcoFalke 5713994de9
Merge #13052: trivial: Fix relevent typo
6ad47b04b9 trivial: Fix relevent typo (practicalswift)

Pull request description:

  Fix relevent typo.

Tree-SHA512: 29247a780ab2caf0180c3558632a00068b02b4de4a56825f425c66a1e515542ab1e5268971ffa9a63e46840504101b5e6a5f8dcb6070522ac3f5ca90a28262b9
2018-04-23 10:46:19 -04:00
Wladimir J. van der Laan d5b2e98250
Merge #12510: test: Add rpc_bind test to default-run tests
e87fefc test: Add rpc_bind test to default-run tests (Wladimir J. van der Laan)

Pull request description:

  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, which will skip the test) left, add this test to the default in test_runner.

  ~~(the non-IPv6 parts of the two dual-IPv4/6 tests could also be enabled, but first going to look what Travis does here to see if there wasn't another reason it was disabled)~~ done, it only makes sense for the first

Tree-SHA512: 724259b14f59dccc7e61ef071359336adb0f76a63db392b6ce6940e21c8ee0470c35374e82970681261685ef299cd70b0c1372598cea85d341f64c2c40ea28ee
2018-04-23 16:07:22 +02:00
Wladimir J. van der Laan 4741ca5dc8
Merge #13020: Consistently log CValidationState on call failure
e4d0b44 Consistently log CValidationState on failure (Ben Woosley)

Pull request description:

  This replaces potential silent failures and partial logging with full logging. Seems providing at least minimal visibility to the failure is a good practice. E.g. `FlushStateToDisk` can return a rare but meaningful out of disk space error that would be better to note than leave out.

  Note many of these are related to `ActivateBestChain` or `FlushStateToDisk`. Only a few cases of ignored state remain, e.g. LoadExternalBlockFile and RelayWalletTransaction, where I expect logging would likely be spammy.

Tree-SHA512: fb0e521039e5a5250cd9c82e7a8676423b5e3899d495649c0e71752059d1984e5175f556386ade048f51a7d59f5c8e467df7fe91d746076f97d24c000ccf7891
2018-04-23 14:37:45 +02:00
Wladimir J. van der Laan 8b4081a889
Merge #13039: Add logging and error handling for file syncing
cf02779 Add logging and error handling for file syncing (Wladimir J. van der Laan)

Pull request description:

  Add logging and error handling inside, and outside of FileCommit.
  Functions such as fsync, fdatasync will return error in case of hardware I/O errors, and ignoring this means it can silently continue through data corruption.
  (c.f. https://lwn.net/SubscriberLink/752063/12b232ab5039efbe/)

  EINVAL is handled specially to avoid crashing out on (network, fuse) filesystems that don't handle `f[data]sync`.

  I checked that the syncing inside leveldb is already generating an I/O error as appropriate.

Tree-SHA512: 64cc9bbedca3ecc97ff4bac0a7b7ac6526a7ed763c66f6786d03ca4f2e9e366e42b152cb908299c060448d98ca39ff03395280bffaca51d592e728aa2516f5dd
2018-04-23 14:30:26 +02:00
Wladimir J. van der Laan cf0277928f Add logging and error handling for file syncing
Add logging and error handling inside, and outside of FileCommit.
Functions such as fsync, fdatasync will return error in case of hardware
I/O errors, and ignoring this means it can silently continue through
data corruption.  (c.f.
https://lwn.net/SubscriberLink/752063/12b232ab5039efbe/)
2018-04-23 14:25:28 +02:00
Wladimir J. van der Laan e2746db66f
Merge #13016: scripted-diff: Rename CChainState::g_failed_blocks to m_failed_blocks
3cc9094 scripted-diff: Rename CChainState::g_failed_blocks to m_failed_blocks (Ben Woosley)

Pull request description:

  To reflect its actual status as a member rather than a global value.

  g_failed_blocks was previously global: 2862aca40f

Tree-SHA512: a0e679a151e0fb70d245a7a1821449d0a4738f5ba503abca9f19d9cfbcbb0e72a1598e3364e29775b0c203acd6d04d882d2788208f685edc57aaba5e946fde3b
2018-04-23 10:34:45 +02:00
Wladimir J. van der Laan 65d7083f15
Merge #13017: Add wallets management functions
3c058fd wallet: Add HasWallets (João Barbosa)
373aee2 wallet: Add AddWallet, RemoveWallet, GetWallet and GetWallets (João Barbosa)
6efd964 refactor: Drop CWalletRef typedef (João Barbosa)

Pull request description:

  This is a small step towards dynamic wallet load/unload. The wallets *registry* `vpwallets` is used in several places. With these new functions all `vpwallets` usage are removed and `vpwallets` is now a static variable (no external linkage).

  The typedef `CWalletRef` is also removed as it is narrowly used.

Tree-SHA512: 2ea19da2e17b521ad678bfe10f3257e497ccaf7ab9fd0b6647f9d829f1d6131cfa68db8e8492421711c6da399859432b963a568bdd4ca40a77dd95b597839423
2018-04-23 07:59:02 +02:00
practicalswift 6ad47b04b9 trivial: Fix relevent typo 2018-04-22 12:53:35 +02:00
Wladimir J. van der Laan 3e60b9cfa7
Merge #12998: Default to defining endian-conversion DECLs in compat w/o config
150b2f0 Default to defining endian-conversion DECLs in compat w/o config (Matt Corallo)

Pull request description:

  While this isn't a supported build configuration, some build
  systems need to build without going through our autotools steps,
  so defaulting to something sane may make it easier to build.

  Specifically, this fixes the inability to build
  rust-bitcoinconsensus on some non-x86 platforms. It needs to build
  without our autotools/configure steps to ensure correct compile
  args are passed from the rust build system to gcc. Converting the
  args from the rust build system to gcc would be a lot of
  unmaintainable work.

Tree-SHA512: 776fdb8c91b66f421fc751cb281c99c53c47e496f46b26c9f49bb6fdb6da3d2dda5dcc1c5bf413206bdd9ff3cbe5cef2823455900462519a4944631d9c48b54c
2018-04-22 11:56:23 +02:00
MarcoFalke cac6d1184d
Merge #13048: [tests] Fix feature_block flakiness
c1d742025c [tests] Fix feature_block flakiness (John Newbery)

Pull request description:

  feature_block.py occasionally fails on Travis. I believe this is due to
  a a race condition when reconnecting to bitcoind after a subtest that
  expects disconnection. If the test runs ahead and sends the INV for the
  subsequent test before we've received the initial sync getheaders, then
  we may end up sending two headers messages - one as a response to the
  initial sync getheaders and one in response to the INV getheaders. If
  both of those headers fail validation with a DoS score of 50 or higher,
  then we'll unexpectedly be disconnected.

  There is only one validation failure that has a DoS score bewteen 50 and
  100, which is high-hash. That's why the test is failing immediately
  after the "Reject a block with invalid work" subtest.

  Fix is to wait for the initial getheaders from the peer before we
  start populating our blockstore. That way we won't have any invalid
  headers to respond to it with.

Tree-SHA512: dc17d795fcfaf0f8c0bf1e9732b5e11fbc8febbfafba4c231b7c13a5404a2c297dcd703a7a75bc7f353c893e12efc87f424f2201abd47ba5268af32d4d2e841f
2018-04-21 21:00:06 -04:00
MarcoFalke f644ea487a
Merge #13047: [trivial] Tidy blocktools.py
4d355bfb2b [tests] tidy up blocktools.py (John Newbery)
cab8be5adf [tests] Fix flake8 warnings in blocktools.py (John Newbery)
b184127db2 [doc][trivial] no retargeting in regtest mode (Jesse Cohen)

Pull request description:

  Tidies up the blocktools.py module:

  - fixes flake8 warnings
  - changes function-level comments to docstrings.

  Takes in @skeees's commit b184127db2

Tree-SHA512: 0f4c59ac8ccc9057492ec1996381e73380d65e85240f2ba9607174c0743d3a1853c4ed35a9e1bc704b2b6d6d823ac77aa7e81bd150cf5033de79293c24b791b0
2018-04-21 08:49:57 -04:00
John Newbery c1d742025c [tests] Fix feature_block flakiness
feature_block.py occasionally fails on Travis. I believe this is due to
a a race condition when reconnecting to bitcoind after a subtest that
expects disconnection. If the test runs ahead and sends the INV for the
subsequent test before we've received the initial sync getheaders, then
we may end up sending two headers messages - one as a response to the
initial sync getheaders and one in response to the INV getheaders. If
both of those headers fail validation with a DoS score of 50 or higher,
then we'll unexpectedly be disconnected.

There is only one validation failure that has a DoS score bewteen 50 and
100, which is high-hash. That's why the test is failing immediately
after the "Reject a block with invalid work" subtest.

Fix is to wait for the initial getheaders from the peer before we
start populating our blockstore. That way we won't have any invalid
headers to respond to it with.
2018-04-20 15:45:31 -04:00
John Newbery 4d355bfb2b [tests] tidy up blocktools.py
Moves function comments to docstrings, and moves the module-level
constant to the top of the file.
2018-04-20 14:16:57 -04:00
John Newbery cab8be5adf [tests] Fix flake8 warnings in blocktools.py 2018-04-20 14:10:12 -04:00
Jesse Cohen b184127db2 [doc][trivial] no retargeting in regtest mode 2018-04-20 13:55:22 -04:00
Pieter Wuille 8b262eb2d8
Merge #13021: MOVEONLY: Move logging code from util.{h,cpp} to new files.
b77b6e2345 MOVEONLY: Move logging code from util.{h,cpp} to new files. (Jim Posen)

Pull request description:

  Split out first commit from #12954 to reduce amount of rebasing necessary.

  This introduces a cyclic dependency between `logging` and `util` that should be cleaned up in a future PR.

Tree-SHA512: 695e512f9c2f7b4ca65e367fc924358e3cb2dc531bcbb7a6f62710b2a87280b35aba7793aa272e457fcd65448abe3feb1deb3b8064ed208917ca356b0f410813
2018-04-19 22:08:19 -07:00
MarcoFalke 0a8b7b4b33
Merge #11739: Enforce SCRIPT_VERIFY_P2SH and SCRIPT_VERIFY_WITNESS from genesis
8b56fc0b91 [qa] Test that v0 segwit outputs can't be spent pre-activation (Suhas Daftuar)
ccb8ca42a4 Always enforce SCRIPT_VERIFY_WITNESS with P2SH (Suhas Daftuar)
5c31b20a35 [qa] Remove some pre-activation segwit tests (Suhas Daftuar)
95749a5836 Separate NULLDUMMY enforcement from SEGWIT enforcement (Suhas Daftuar)
ce650182f4 Use P2SH consensus rules for all blocks (Suhas Daftuar)

Pull request description:

  As discussed at the IRC meeting back in October (https://botbot.me/freenode/bitcoin-core-dev/2017-10-12/?msg=92231929&page=2), I had looked into the feasibility of enforcing P2SH and SCRIPT_VERIFY_WITNESS back to the genesis block.

  The P2SH change is pretty straightforward -- there was only one historical block on mainnet that violated the rule, so I carved out an exception to it, similar to the way we have exceptions for the BIP30 violators.

  The segwit change is not entirely as clear.  The code changes themselves are relatively straightforward: we can just always turn on SCRIPT_VERIFY_WITNESS whenever P2SH is active.  However conceptually, this amounts to splitting up BIP141 into two parts, the part that implements new script rules, and the part that handles witness commitments in blocks.

  Arguably though the script rules are really defined in BIP 143 anyway, and so this really amounts to backdating BIP 143 -- script rules for v0 segwit outputs -- back to genesis.  So maybe conceptually this isn't so bad...

  I don't feel strongly about this change in either direction; I started working on it because I was searching for a way to simplify the way we understand and implement the consensus rules around segwit, but I'm not yet sure whether I think this achieves anything toward that goal.

  ping @TheBlueMatt

Tree-SHA512: 73551d4a983eb9792c7ac67f56005822528ac4d1fd52c27cee6d305ebee953f69687ef4ddee8bdc0fec77f77e6b5a9d669750793efee54c076533a095e233042
2018-04-19 14:38:40 -04:00
MarcoFalke 9b3a67eb08
Merge #13026: Fix include comment in src/interfaces/wallet.h
defffb3587 trivial: Improve include comment in src/interfaces/wallet.h (João Barbosa)

Pull request description:

Tree-SHA512: dfb873db4be0bdaff99ee57628a64284de5ad484b4020e386ab2f5e0b478ff11d49b094d02e3e58cd2bec1d44b3b550b9c5f3da177518087cc62b4a3c9ca824e
2018-04-19 14:33:00 -04:00
João Barbosa defffb3587 trivial: Improve include comment in src/interfaces/wallet.h 2018-04-19 14:30:07 +01:00
Wladimir J. van der Laan c199869408
Merge #12855: net: Minor accumulated cleanups
2c084a6 net: Minor accumulated cleanups (Thomas Snider)

Pull request description:

  From now-derelict larger changes I had been working on, here are a series of DRY refactors/cleanups.  Net loss of 35 lines of code - a small step in the good fight.

  In particular I think operator!= should only ever be implemented as a negation of operator==.  Lower chance for errors, and removes the possibility of divergent behavior.

Tree-SHA512: 58bf4b542a4e8e5bc465b508aaa16e9ab51448c3f9bee52cd9db0a64a5c6c5a13e4b4286d0a5aa864934fc58064799f6a88a40a87154fd3a4bd731a72e254393
2018-04-19 14:58:09 +02:00
MarcoFalke 39cf27faf3
Merge #13025: Dead code removal
1bf3f33b46 node: Removed unused wallet-related methods from the Node interface. (Thomas Snider)
b38200459f benchmark: Removed bench/perf.cpp (Thomas Snider)

Pull request description:

  Not sure if these should be separate PRs.

  First is removal of a platform abstraction for getting cycle counters where possible.  Since the benchmarking switch to counting number of iterations over a fixed window instead of counting cycles per iteration, these are unused.

  Second is removal of a few methods from the Node interface that seem vestigial from when the concepts of wallet/node were not as clearly separated.

Tree-SHA512: de1460a7d4473ca19db4e2ca845185c63c765d12462c2685044a1f27dedab266cd908bc52235a881a7ad98bc251a4abf4eae523e5f599c169e3511e489f19a0d
2018-04-19 07:58:36 -04:00
Thomas Snider 1bf3f33b46 node: Removed unused wallet-related methods from the Node interface. 2018-04-18 19:53:30 -07:00
Thomas Snider b38200459f benchmark: Removed bench/perf.cpp 2018-04-18 19:53:10 -07:00
Ben Woosley e4d0b44373
Consistently log CValidationState on failure
Seems providing at least minimal visibility to the failure is a good practice.

The only remaining ignored state is in LoadExternalBlockFile, where logging
would likely be spammy.
2018-04-18 18:43:12 -04:00
João Barbosa 3c058fdcc8 wallet: Add HasWallets 2018-04-18 22:07:58 +01:00
João Barbosa 373aee26c3 wallet: Add AddWallet, RemoveWallet, GetWallet and GetWallets
With these new functions all vpwallets usage are removed
and vpwallets is now a static variable (no external linkage).
2018-04-18 22:07:33 +01:00
Jim Posen b77b6e2345 MOVEONLY: Move logging code from util.{h,cpp} to new files. 2018-04-18 10:05:05 -07:00
João Barbosa 6efd9644cf refactor: Drop CWalletRef typedef 2018-04-18 13:41:28 +01:00
Ben Woosley 3cc9094d36
scripted-diff: Rename CChainState::g_failed_blocks to m_failed_blocks
To reflect its actual status as a member rather than a global value.

g_failed_blocks was previously global: 2862aca40f

-BEGIN VERIFY SCRIPT-
sed -i 's/g_failed_blocks/m_failed_blocks/g' src/validation.cpp
-END VERIFY SCRIPT-
2018-04-18 05:10:36 -07:00
Wladimir J. van der Laan 615f7c2884
Merge #12985: Windows: Avoid launching as admin when NSIS installer ends.
7d8a8cc Avoid launching as admin when NSIS installer ends. (JeremyRand)

Pull request description:

  The Bitcoin Core NSIS script runs with elevated privileges.  Unfortunately, this means that it launches Bitcoin Core itself with elevated privileges when the user chooses to launch Bitcoin Core at the end of the installation procedure.  This PR works around the issue by having `explorer.exe` launch Bitcoin Core.  Seems to be a similar approach to what http://nsis.sourceforge.net/ShellExecAsUser_plug-in does, but without a plugin.

  I've tested this with Sysinternals Process Explorer on Windows 10 32-bit.  I wouldn't expect any differences in behavior on other Windows releases, but if anyone would like to test on other Windows releases, feel free.

  h/t to "UK" at https://mdb-blog.blogspot.se/2013/01/nsis-lunch-program-as-user-from-uac.html?showComment=1410158039989#c2463780017054126736 for the sample code.

  Fixes #7990.

Tree-SHA512: f40d6b6e5bb72952dcfbf223b68bfeb9a03bd5638f41b1700f4651f6452ce3fe7468129f6652c4f546210a5fd2521b2574c4b6068c5aea01ed2d719a8a838cd8
2018-04-18 11:52:06 +02:00
Wladimir J. van der Laan 0d12570a80
Merge #13007: test: Fix dangling wallet pointer in vpwallets
d41a420 test: Fix dangling wallet pointer in vpwallets (João Barbosa)

Pull request description:

Tree-SHA512: 83e4ec571f1675b3dab6f7606f29d6fae495d998b4e5794ff14315943783d4518cfa66eba4113293e349eb74aa22a024b21272fdb29c212477edb4c09aec9fa7
2018-04-18 11:30:24 +02:00
Wladimir J. van der Laan 8fd62437c6
Merge #12715: depends: Add 'make clean' rule
aff16fd depends: Add 'make clean' and 'make clean-all' rules (Henrik Jonsson)

Pull request description:

  It's useful to have a standard way to clean up the work done by the
  depends system when testing changes to it.

Tree-SHA512: d56686ca810c2531d852049420f242178d124d45a2508feeac0acf80408e8a95fc9915fb777ff0cbc4edc496990f5fdecf699c87d7986164c74b8fbf418ebf49
2018-04-18 11:28:05 +02:00
James O'Beirne 18326ae2a7 [doc] Add comments for chainparams.h, validation.cpp 2018-04-17 17:15:20 -04:00
Jonas Schnelli 3a8a4dc4a1
Merge #12791: Expose a transaction's weight via RPC
9e50c337c Note new weight field in release-notes. (Matt Corallo)
d0d9112b7 Test new weight field in p2p_segwit (Matt Corallo)
2874709a9 Expose a transaction's weight via RPC (Matt Corallo)

Pull request description:

  This seems like an obvious oversight.

Tree-SHA512: defd047de34fb06a31f589e1a4eef68fcae85095cc67b7c8fb434237bb40300d7f3f97e852d3e7226330e26b96943846b7baf6da0cfc79db8d56e9c1f7848ad9
2018-04-17 20:05:23 +02:00
João Barbosa d41a420562 test: Fix dangling wallet pointer in vpwallets 2018-04-17 18:28:54 +01:00
MarcoFalke 6b46288a08
Merge #12949: tests: Avoid copies of CTransaction
fae58eca93 tests: Avoid copies of CTransaction (MarcoFalke)

Pull request description:

  Avoid the copy (or move) constructor of `CTransaction` in test code, whereever a simple reference can be used instead.

Tree-SHA512: 8ef2077a277d6182996f4671722fdc01a90909ae7431c1e52604aab8ed028910615028caf9b4cb07a9b15fdc04939dea2209cc3189dde7d38271256d9fe1076c
2018-04-17 13:28:12 -04:00
MarcoFalke a63b4e3493
Merge #12982: Fix inconsistent namespace formatting guidelines
cd0e1e91dd Fix inconsistent namespace formatting guidelines (Russell Yanofsky)

Pull request description:

  Suggested formatting for namespaces in the developer guide is currently inconsistent. This commit updates the developer guide and clang-format configuration to consistently put "namespace" and opening/closing braces on the same line. Example:

  ```c++
  namespace boost {
  namespace signals2 {
  class connection;
  } // namespace signals2
  } // namespace boost
  ```

  Currently the [Source code organization](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#source-code-organization) section has an example like the one above, but the [Coding style](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style) section example and description put a newline between the opening "namespace foo" and brace (but oddly no newline between closing namespace and brace).

  Avoiding newlines before namespace opening braces makes nested declarations less verbose and also avoids asymmetry with closing braces. It's also a common style used in our own and other codebases:

  * https://google.github.io/styleguide/cppguide.html#Namespaces
  * https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
  * https://llvm.org/docs/CodingStandards.html#namespace-indentation

Tree-SHA512: 507259478e1a7f6f96db386dd04eb25aa04294f533503fdd82368cf809c3ceaa20204b2cb6ae65322eb27446e5934c1aa1ccb6240ead12aa06b314af76f68139
2018-04-17 13:22:36 -04:00
Wladimir J. van der Laan 58bbc55212
Merge #13004: Print to console by default when not run with -daemon
6a3b0d3 Print to console by default when not run with -daemon (Evan Klitzke)

Pull request description:

  Cherry-picked ef6fa1c38e1bd115d1cce155907023d79da379d8 from the "up for grabs" PR: "Smarter default behavior for -printtoconsole" (#12689).

  See previous review in #12689.

Tree-SHA512: 8923a89b9c8973286d53e960d3c464b1cd026cd5a5911ba62f9f972c83684417dc4004101815dfe987fc1e1baaec1fdd90748a0866bb5548e974d77b3135d43b
2018-04-17 17:07:35 +02:00
Wladimir J. van der Laan 39e0c65b29
Merge #12988: Hold cs_main while calling UpdatedBlockTip() signal
d86edd3 Hold cs_main while calling UpdatedBlockTip() and ui.NotifyBlockTip (Jesse Cohen)

Pull request description:

  Resolves #12978

Tree-SHA512: 2aed09434cd8dbf541ea75462070b73ee87ff31409bede210f6999ffee4a37e32202a289efd37609485d4cbdfe134fe4660a10bfb41e8a8acdba7cd0b61b8780
2018-04-17 16:01:12 +02:00
Wladimir J. van der Laan 434150aef7
Merge #12977: Refactor g_wallet_init_interface to const reference
6ec78f1 wallet: Refactor g_wallet_init_interface to const reference (João Barbosa)
1936125 wallet: Make WalletInitInterface members const (João Barbosa)

Pull request description:

Tree-SHA512: c382156a38d4c6beaa6c48f911d7b314542b9500d88724b2b3029dae4491cb1e60e10628f6632d1366818ccf343f494650b3171593b5450149544ba198f49bb5
2018-04-17 15:58:13 +02:00
Jonas Schnelli 3076993048
Merge #12899: macOS: Prevent Xcode 9.3 build warnings
2eb5036c3 macOS: Prevent Xcode 9.3 build warnings (Akio Nakamura)

Pull request description:

  This PR intends to solve #12867

  1. clang (Apple LLVM version 9.1.0 (clang-902.0.39.1)) warns unused argument '-pie' during compilation. This parameter should pass to the linker, so use '-Wl,-pie' style in configure.ac.
  2. The other hand, when linking libbitcoinconsensus.la with passing '-Wl,-pie', ld warns that '-pie' being ignored because not link a main executable. So remove it from $libbitcoinconsensus_la_LDFLAGS in src/Makefile.am.

  - In order to apply this change to Makefile, you need to run autogen.sh and ./configure.
  - I think no need to add if-clause by target-os because also g++ can recognize/handle  '-Wl,-pie'.
  - I confirmed that the build was successful on macos10.13.4/XCode9.3 and ubuntu 17.10/g++7.2.0 and that warning was not issued.

Tree-SHA512: 45b7c3881f3ad92172eb2ff6fa90c4dc70a42037450ea4b6fd87613b10c0aa90ebcffd54e7c50b70ba876b7c2e356825950fbf5a7a4e8e25118688d98d7b6ee0
2018-04-17 10:58:42 +02:00
Evan Klitzke 6a3b0d3d1a Print to console by default when not run with -daemon
Printing to the debug log file can be disabled with -nodebulogfile
2018-04-17 09:58:05 +02:00
Jesse Cohen d86edd3d30 Hold cs_main while calling UpdatedBlockTip() and ui.NotifyBlockTip
Ensures that callbacks are invoked in the order in which the chain is updated
Resolves #12978
2018-04-16 18:03:21 -04:00
Thomas Snider 2c084a6609 net: Minor accumulated cleanups 2018-04-16 13:24:14 -07:00
MarcoFalke 07825088f9
Merge #12972: Add python3 script shebang lint
2bff472992 [contrib] convert test-security-check to python3 (John Newbery)
958bf40489 add lint tool to check python3 shebang (practicalswift)

Pull request description:

  base58.py can executed by python3

Tree-SHA512: 30511204feefd4ccd5b4bf698fb88e516633e692dc95d31fe957b1c0c4879de25906355b28a5a0522171887315c8464a611e601ff00540db172d5bd463ee13d9
2018-04-16 16:03:22 -04:00
Wladimir J. van der Laan 4366f61cc9
Merge #11862: Network specific conf sections
c25321f Add config changes to release notes (Anthony Towns)
5e3cbe0 [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections (Anthony Towns)
005ad26 ArgsManager: special handling for -regtest and -testnet (Anthony Towns)
608415d [tests] Unit tests for network-specific config entries (Anthony Towns)
68797e2 ArgsManager: Warn when ignoring network-specific config setting (Anthony Towns)
d1fc4d9 ArgsManager: limit some options to only apply on mainnet when in default section (Anthony Towns)
8a9817d [tests] Use regtest section in functional tests configs (Anthony Towns)
30f9407 [tests] Unit tests for config file sections (Anthony Towns)
95eb66d ArgsManager: support config file sections (Anthony Towns)
4d34fcc ArgsManager: drop m_negated_args (Anthony Towns)
3673ca3 ArgsManager: keep command line and config file arguments separate (Anthony Towns)

Pull request description:

  The weekly meeting on [2017-12-07](http://www.erisian.com.au/meetbot/bitcoin-core-dev/2017/bitcoin-core-dev.2017-12-07-19.00.log.html) discussed allowing options to bitcoin to have some sensitivity to what network is in use. @theuni suggested having sections in the config file:

      <cfields> an alternative to that would be sections in a config file. and on the
                cmdline they'd look like namespaces. so, [testnet] port=5. or -testnet::port=5.

  This approach is (more or less) supported by `boost::program_options::detail::config_file_iterator` -- when it sees a `[testnet]` section with `port=5`, it will treat that the same as "testnet.port=5". So `[testnet] port=5` (or `testnet.port=5` without the section header) in bitcoin.conf and `-testnet.port=5` on the command line.

  The other aspect to this question is possibly limiting some options so that there is no possibility of accidental cross-contamination across networks. For example, if you're using a particular wallet.dat on mainnet, you may not want to accidentally use the same wallet on testnet and risk reusing keys.

  I've set this up so that the `-addnode` and `-wallet` options are `NETWORK_ONLY`, so that if you have a bitcoin.conf:

      wallet=/secret/wallet.dat
      upnp=1

  and you run `bitcoind -testnet` or `bitcoind -regtest`, then the `wallet=` setting will be ignored, and should behave as if your bitcoin.conf had specified:

      upnp=1

      [main]
      wallet=/secret/wallet.dat

  For any `NETWORK_ONLY` options, if you're using `-testnet` or `-regtest`, you'll have to add the prefix to any command line options. This was necessary for `multiwallet.py` for instance.

  I've left the "default" options as taking precedence over network specific ones, which might be backwards. So if you have:

      maxmempool=200
      [regtest]
      maxmempool=100

  your maxmempool will still be 200 on regtest. The advantage of doing it this way is that if you have `[regtest] maxmempool=100` in bitcoin.conf, and then say `bitcoind -regtest -maxmempool=200`, the same result is probably in line with what you expect...

  The other thing to note is that I'm using the chain names from `chainparamsbase.cpp` / `ChainNameFromCommandLine`, so the sections are `[main]`, `[test]` and `[regtest]`; not `[mainnet]` or `[testnet]` as might be expected.

  Thoughts? Ping @MeshCollider @laanwj @jonasschnelli @morcos

Tree-SHA512: f00b5eb75f006189987e5c15e154a42b66ee251777768c1e185d764279070fcb7c41947d8794092b912a03d985843c82e5189871416995436a6260520fb7a4db
2018-04-16 20:52:38 +02:00
MarcoFalke 6a278e0640
Merge #12996: tests: Remove redundant bytes(…) calls
9db48c5634 tests: Remove redundant bytes² (practicalswift)

Pull request description:

  This is a follow-up to #12993. As @jnewbery noted `bytes()` is idempotent.

Tree-SHA512: 0eb25e0c2c46f9abaac30f964c5eb422bece1414c840a717d86794424294cb19d995a6db7c8df2a2f4ec84776b05274a637f2c111738f397051f510e57184752
2018-04-16 11:53:57 -04:00
MarcoFalke fe8fa22d7a
Merge #12987: tests/tools: Enable additional Python flake8 rules for automatic linting via Travis
643aad17fa Enable additional flake8 rules (practicalswift)
f020aca297 Minor Python cleanups to make flake8 pass with the new rules enabled (practicalswift)

Pull request description:

  Enabled rules:

  ```
  * E242: tab after ','
  * E266: too many leading '#' for block comment
  * E401: multiple imports on one line
  * E402: module level import not at top of file
  * E701: multiple statements on one line (colon)
  * E901: SyntaxError: invalid syntax
  * E902: TokenError: EOF in multi-line string
  * F821: undefined name 'Foo'
  * W293: blank line contains whitespace
  * W606: 'async' and 'await' are reserved keywords starting with Python 3.7
  ```

  Note to reviewers:
  * In general we don't allow whitespace cleanups to existing code, but in order to allow for enabling Travis checking for these rules a few smaller whitespace cleanups had to made as part of this PR.
  * Use [this `?w=1` link](https://github.com/bitcoin/bitcoin/pull/12987/files?w=1) to show a diff without whitespace changes.

  Before this commit:

  ```
  $ flake8 -qq --statistics --ignore=B,C,E,F,I,N,W --select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E741,E742,E743,F401,E901,E902,F402,F404,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,F841,W292,W293,W504,W601,W602,W603,W604,W605,W606 .
  5     E266 too many leading '#' for block comment
  4     E401 multiple imports on one line
  6     E402 module level import not at top of file
  5     E701 multiple statements on one line (colon)
  1     F812 list comprehension redefines 'n' from line 159
  4     F821 undefined name 'ConnectionRefusedError'
  28    W293 blank line contains whitespace
  ```

  After this commit:

  ```
  $ flake8 -qq --statistics --ignore=B,C,E,F,I,N,W --select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E741,E742,E743,F401,E901,E902,F402,F404,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,F841,W292,W293,W504,W601,W602,W603,W604,W605,W606 .
  $
  ```

Tree-SHA512: fc7d5e752298a50d4248afc620ee2c173135b4ca008e48e02913ac968e5a24a5fd5396926047ec62f1d580d537434ccae01f249bb2f3338fa59dc630bf97ca7a
2018-04-16 11:50:23 -04:00