Commit graph

16999 commits

Author SHA1 Message Date
Wladimir J. van der Laan
8609ddb368
Merge #12999: qt: Show the Window when double clicking the taskbar icon
67bf2aa qt:Show the entire Window when double clicking on taskbar (Chun Kuan Lee)

Pull request description:

  fix #12838

Tree-SHA512: 4498bc1fe52efeed3768d6bdd7941e4b036d52ae80d9c1b6679c6daa3a62aeda4cff0c91fe1c65afaea6049c59cb0296fdcbff63ecb342d518615a92361fda7f
2018-04-23 21:01:08 +02:00
Wladimir J. van der Laan
d3f04c0e81
Merge #13030: [bugfix] [wallet] Fix zapwallettxes/multiwallet interaction.
1f83839 [wallet] [tests] Test disallowed multiwallet params (John Newbery)
3476e3c [wallet] Fix zapwallettxes/multiwallet interaction. (John Newbery)

Pull request description:

  `-zapwallettxes` should be disallowed when starting bitcoin in multiwallet mode.

  There's code in `WalletInit::ParameterInteraction()` to disallow `-zapwallettxes` when running in multiwallet mode. This code functioned as expected when passing the parameter `-zapwallettxes=1`, but not when passing the parameter `-zapwallettxes` (ie without the value specified). Fix that and add a test.

  The new test in the
  _[wallet] [tests] Test disallowed multiwallet params_ commit reproduces the bug and should fail against master.

  Fixes #12505

Tree-SHA512: 6cd921717e9c7d2773ca84c946c310c2adec8430e37cbecdb33a620f510db3058a72bd328411812ba415111bc52a3367b332c9d15a37a92ccfd7ae785d2f32ab
2018-04-23 20:23:18 +02:00
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
fac0db0ff8
wallet: Make fee settings non-static members 2018-04-23 10:49:21 -04: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
aee80b0ef9 qt: Don't log to console by default
Default `-printtoconsole` to false for the GUI. GUI programs should not
print to the console unnecessarily. For example, when launched by the
window manager, the output might end up in the X session log file,
resulting in duplicate logging. On Windows, it is pointless as well
because bitcoin-qt isn't a console application.
2018-04-23 09:25:34 +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
Chun Kuan Lee
8b8032e283
test: Add rpcauth pair that generated by rpcauth 2018-04-23 06:32:58 +08: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
fa811b0b1d
qa: Normalize executable location 2018-04-21 16:55:42 -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
Pieter Wuille
7d0f80bbf4 Use anonymous namespace instead of static functions 2018-04-19 21:06:47 -07:00
Pieter Wuille
b61fb71136 Mention removal of bare multisig IsMine in release notes 2018-04-19 21:05:14 -07:00
Pieter Wuille
9c2a8b8d34 Do not treat bare multisig as IsMine
Such outputs can still be watched, and signed for, but they aren't treated as valid payments.
That means they won't cause transactions to appear in listtransactions, their outputs to be
shown under listunspent, or affect balances.
2018-04-19 21:05:14 -07:00
Pieter Wuille
08f3228654 Optimization: only test for witness scripts at top level
Inside P2SH scripts we already know that the P2SH script version of witness keys/scripts
are acceptable, so there is no need to test for it again.
2018-04-19 21:05:14 -07:00
Pieter Wuille
3619735b09 Track difference between scriptPubKey and P2SH execution in IsMine
Inside IsMine we care about the distinction between scriptPubKey execution
and P2SH redeemScript execution. The consensus code does not care about this
distinction, and thus SigVersion does not have a field for P2SH. As the IsMine
code will care, it uses a separate enum with more fields.
2018-04-19 21:05:04 -07:00
Pieter Wuille
ac6ec62522 Switch to a private version of SigVersion inside IsMine
This will allow us to have the consensus code and IsMine code diverge.
2018-04-19 20:53:18 -07:00
Pieter Wuille
19fc973097 Do not expose SigVersion argument to IsMine
Only IsMine's internal code needs this, as part of a recursion into P2SH and P2WSH
scripts. The exposed functions always operate on actual scriptPubKeys and not on
redeemScripts or witness scripts.
2018-04-19 20:52:47 -07:00
Kristaps Kaupe
1accfbcf46 Output values for "min relay fee not met" error 2018-04-20 02:47:13 +03:00
Aaron Clauson
abd58a2fca Fix for utiltime to compile with msvc. 2018-04-20 08:41:15 +10: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
John Newbery
1f838394bf [wallet] [tests] Test disallowed multiwallet params
Add a test to check that bitcoind fails to start when specifying
-zapwallettxes, -salvagewallet and -upgradewallet when running in
multiwallet mode.
2018-04-19 11:13:47 -04:00
John Newbery
3476e3c48b [wallet] Fix zapwallettxes/multiwallet interaction.
-zapwallettxes should be disallowed when starting bitcoin in multiwallet
mode.
2018-04-19 11:07:54 -04:00
James O'Beirne
80a5e59532 [qa] Attach node index to test_node AssertionError and print messages
to aid debugging. Feedback incorporated from @Empact.
2018-04-19 10:21:36 -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
Pieter Wuille
fb1dfbbec0 Remove unused IsMine overload 2018-04-18 17:08:53 -07:00
Pieter Wuille
952d8213a6 Make CScript -> CScriptID conversion explicit 2018-04-18 17:08:50 -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