Commit graph

13356 commits

Author SHA1 Message Date
MarcoFalke 9133227298
Merge #14935: tests: Test for expected return values when calling functions returning a success code
c84c2b8c92 tests: Test for expected return values when calling functions returning a success code (practicalswift)

Pull request description:

  Test for expected return values when calling functions returning a success code (instead of discarding the return values).

  **Note to reviewers:** The following commands can be used to verify that the only text fragments added in this PR are `BOOST_CHECK(`, `!` and `)` :

  ```
  $ git diff HEAD~1 | grep -E '^[\-][^\-]' | cut -b2- > before.txt
  $ git diff HEAD~1 | grep -E '^[\+][^\+]' | cut -b2- > after.txt
  $ cat after.txt | sed 's/BOOST_CHECK(//g' | sed 's/));/);/g' | tr -d '!' > after-sed.txt
  $ diff -u before.txt after-sed.txt
  $
  ```

Tree-SHA512: ff0863ef2046a2eda3c44e9c6b9aedfe167881f2fa58db29fef859416831233ef6502a3a11fd2322bc1a924db83df8d4a5c5879298007f2a7b085e2a7286af70
2018-12-14 14:21:23 -05:00
João Barbosa bf4383277d rpc: Remove unused PreCommand signal 2018-12-14 15:54:50 +00:00
MeshCollider 7a30e0f6c5
Merge #14821: Replace CAffectedKeysVisitor with descriptor based logic
0e75f44a0 Replace CAffectedKeysVisitor with descriptor based logic (Pieter Wuille)

Pull request description:

  It seems we don't need a custom visitor pattern anymore to find what keys are affected by a script. Instead, infer the descriptor, and see which keys it expands to.

Tree-SHA512: 8a52f61fb74e8ebfd8d02e759629e423ced6bd7d9a9ee7c4bdd2cca8465bc27b951cc69c8d835244a611ba55c6d22f83b81acef05487cb988c88c0951b797699
2018-12-14 14:21:29 +13:00
Pieter Wuille 7257353b93 Select orphan transaction uniformly for eviction
The previous code was biased towards evicting transactions whose txid has
a larger gap (lexicographically) with the previous txid in the orphan pool.
2018-12-13 13:46:33 -08:00
MarcoFalke faead93c6c
test: Make g_insecure_rand_ctx thread_local 2018-12-13 14:32:44 -05:00
Wladimir J. van der Laan 20c54eef6e
Merge #14834: validation: assert that pindexPrev is non-null when required
fbaaf782ce validation: assert that pindexPrev is non-null when required (Karl-Johan Alm)

Pull request description:

  In `ContextualCheckBlock`, we are checking if `pindexPrev == nullptr` conditionally at the start, but then assume it is non-`null` later. This removes the latter assumption.

Tree-SHA512: 95f1e9dc839b2cc0e099d155e6180634ece8c6760d00b53e7d27128762e64c92e82d98a5f4a5786b48a4851b17cdbb4b667d3b6a99adb651256e2032de67d05c
2018-12-13 14:37:43 +01:00
Wladimir J. van der Laan 57c9556095
Merge #14940: test: Add test for truncated pushdata script
fa694f706c test: Add tests for truncated scripts (MarcoFalke)

Pull request description:

  Previously not covered by any test

Tree-SHA512: 9f99659bdf3947271074938456a2fe64f5b39fc868e9aa474cec199a536ae5d7428f1cfa7f361936b71b09ee4c426261e6b25668fa77b8416b30dbe4ddb357f0
2018-12-13 14:02:49 +01:00
Wladimir J. van der Laan 378fdfabba
Merge #14624: Some simple improvements to the RNG code
e414486d56 Do not permit copying FastRandomContexts (Pieter Wuille)
022cf47dd7 Simplify testing RNG code (Pieter Wuille)
fd3e7973ff Make unit tests use the insecure_rand_ctx exclusively (Pieter Wuille)
8d98d42611 Bugfix: randbytes should seed when needed (non reachable issue) (Pieter Wuille)
273d02580a Use a FastRandomContext in LimitOrphanTxSize (Pieter Wuille)
3db746beb4 Introduce a Shuffle for FastRandomContext and use it in wallet and coinselection (Pieter Wuille)
8098379be5 Use a local FastRandomContext in a few more places in net (Pieter Wuille)
9695f31d75 Make addrman use its local RNG exclusively (Pieter Wuille)

Pull request description:

  This improves a few minor issues with the RNG code:
  * Avoid calling `GetRand*()` functions (which currently invoke OpenSSL, later may switch to using our own RNG pool) inside loops in addrman, networking code, `KnapsackSolver`, and `LimitOrphanSize`
  * Fix a currently unreachable bug in `FastRandomContext::randbytes`.
  * Make a number of simplifications to the unit tests' randomness code (some tests unnecessarily used their own RNG or the OpenSSL one, instead of using the unit test specific `insecure_rand_ctx`).
  * As a precaution, make it illegal to copy a `FastRandomContext`.

Tree-SHA512: 084c70b533ea68ca7adc0186c39f0b3e0a5c0ae43a12c37286e5d42086e056a8cd026dde61b12c0a296dc80f87fdc87fe303b9e8e6161b460ac2086cf7615f9d
2018-12-13 13:58:20 +01:00
Wladimir J. van der Laan 9c477c990c
Merge #14741: doc: Indicate -rpcauth option password hashing alg
dcb70b1522 Indicate -rpcauth option password hashing alg (Carl Dong)

Pull request description:

  By indicating the password hashing algorithm, users of bitcoin distributions without the script in `share/rpcauth` and users who don't want to rely on said script can use alternative means to generate the password hash.

  Question for reviewers: perhaps we should also indicate that it is specifically a HMAC-SHA-256 of the _**UTF-8**_ encoding of their password?

Tree-SHA512: 86b546c2e78699fa253da0c1e76b21ef60e9b6a5778826ac5136e764d70e3213044cc05cdb4786ba27968781647c46e358a823bbc2db7d45d041d291ee03b83c
2018-12-13 13:29:26 +01:00
practicalswift c84c2b8c92 tests: Test for expected return values when calling functions returning a success code 2018-12-13 09:37:23 +01:00
Pieter Wuille bdacbda253 Overhaul importmulti logic
This introduces various changes to the importmulti logic:
* Instead of processing input and importing things at the same time, first
  process all input data and verify it, so no changes are made in case of
  an error.
* Verify that no superfluous information is provided (no keys or scripts
  that don't contribute to solvability in particular).
* Add way more sanity checks, by means of descending into all involved
  scripts.
2018-12-12 16:32:33 -08:00
Pieter Wuille e414486d56 Do not permit copying FastRandomContexts 2018-12-12 14:28:16 -08:00
Pieter Wuille 022cf47dd7 Simplify testing RNG code 2018-12-12 14:28:15 -08:00
Pieter Wuille fd3e7973ff Make unit tests use the insecure_rand_ctx exclusively 2018-12-12 14:22:12 -08:00
Pieter Wuille 8d98d42611 Bugfix: randbytes should seed when needed (non reachable issue) 2018-12-12 14:22:12 -08:00
Pieter Wuille 273d02580a Use a FastRandomContext in LimitOrphanTxSize 2018-12-12 14:22:12 -08:00
Pieter Wuille 3db746beb4 Introduce a Shuffle for FastRandomContext and use it in wallet and coinselection 2018-12-12 14:22:12 -08:00
Pieter Wuille 8098379be5 Use a local FastRandomContext in a few more places in net 2018-12-12 14:22:12 -08:00
Pieter Wuille 9695f31d75 Make addrman use its local RNG exclusively 2018-12-12 14:22:12 -08:00
MarcoFalke fa694f706c
test: Add tests for truncated scripts 2018-12-12 15:36:46 -05:00
MarcoFalke 6d0a14703e
Merge #14908: test: Removed implicit CTransaction constructor calls from tests and benchmarks.
8db0c3d42b Removed implicit CTransaction conversion from benchmaks (lucash-dev)
ed61abedb2 Removed implicit CTransaction constructor from tests (lucash-dev)

Pull request description:

  This PR was split from #14906 and is a prerequisite for it.
  It updates tests and benchmarks, removing all implicit calls to `CTransaction(CMutableTransaction&)` constructors. This will make possible making the constructor explicit in the next PR.
  The original rationale for making the constructor explicit:

   - Conversion constructors should not be explicit unless there's a strong reason for it (in the opinion of, for example, https://google.github.io/styleguide/cppguide.html, and https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion. Let me know your take on this).
   - This particular conversion is very costly -- it implies a serialization plus hash of the transaction.
   - Even though `CTransaction` and `CMutableTransaction` represent the same data, they have very different use cases and performance properties.
   - Making it explicit allows for easier reasoning of performance trade-offs.
   - There has been previous performance issues caused by unneeded use of this implicit conversion.
   - This PR creates a map for places to look for possible refactoring and performance gains (this benefit still holds if the PR is not merged).

Tree-SHA512: de8073aa6ff8a3153bcbe10818616677ecf9598e4978d8a0b4c39a262e71c36be5679cec08554c760d1f011ba6d37350318248eef15f6d9b86f9e4462b2de0d2
2018-12-12 14:30:24 -05:00
MeshCollider ed2a2cebd3
Merge #13076: Fix ScanForWalletTransactions to return an enum indicating scan result: success / failure / user_abort
bd3b0361d Add stop_block out arg to ScanForWalletTransactions (Ben Woosley)
3002d6cf3 Return a status enum from ScanForWalletTransactions (Ben Woosley)
bb24d6865 Make CWallet::ScanForWalletTransactions args and return value const (Ben Woosley)

Pull request description:

  Return the failed block as an out arg.

  Fixes #11450.

  /cc #12275

Tree-SHA512: 6a523e5425ebfe24e664a942ae21c797ccc1281c25b1bf8d02ad95c19dae343fd8051985ef11853474de7628fd6bed5f15190fbc087c3466ce6fdecab37d72a9
2018-12-12 18:00:42 +13:00
MeshCollider 3fff1ab817
Merge #14646: Add expansion cache functions to descriptors (unused for now)
26879509f Add comments to descriptor tests (Pieter Wuille)
82df4c64f Add descriptor expansion cache (Pieter Wuille)
1eda33aab [refactor] Combine the ToString and ToPrivateString implementations (Pieter Wuille)
24d3a7b3a [refactor] Use DescriptorImpl internally, permitting access to new methods (Pieter Wuille)
6be0fb4b3 [refactor] Add a base DescriptorImpl with most common logic (Pieter Wuille)

Pull request description:

  This patch modifies the internal `Descriptor` class to optionally construct and use an "expansion cache". Such a cache is a byte array that encodes all information necessary to expand a `Descriptor` a second time without access to private keys, and without the need to perform expensive BIP32 derivations. For all currently defined descriptors, the cache simply contains a concatenation of all public keys used.

  This is motivated by the goal of importing a descriptor into the wallet and using it as a replacement for the keypool, where it would be impossible to expand descriptors if they use hardened derivation.

Tree-SHA512: f531a0a82ec1eecc30b78ba8a31724d1249826b028cc3543ad32372e1aedd537f137ab03dbffc222c5df444d5865ecd5cec754c1ae1d4989b6e9baeaffade32a
2018-12-12 17:24:26 +13:00
lucash-dev 8db0c3d42b Removed implicit CTransaction conversion from benchmaks 2018-12-11 19:43:35 -08:00
lucash-dev ed61abedb2 Removed implicit CTransaction constructor from tests 2018-12-11 19:43:35 -08:00
João Barbosa 95a5a9fccb qt: Remove ellipsis from sending/receiving addresses
Considering https://stackoverflow.com/a/637708 the ellipsis in these
menu actions should be removed.
2018-12-11 13:15:35 +00:00
João Barbosa a96c0df35e qt: Add Window menu 2018-12-11 13:15:35 +00:00
João Barbosa 9ea38d0222 qt: Allow to inspect RPCConsole tabs 2018-12-11 13:15:35 +00:00
John Newbery 0025c9eae4 [mining] segwit option must be set in GBT
Calling getblocktemplate without the segwit rule specified is most
likely a client error, since it results in lower fees for the miner.
Prevent this client error by failing getblocktemplate if called without
the segwit rule specified.
2018-12-10 16:42:14 -05:00
MarcoFalke fa9a5bc1a0
RPCHelpMan: Support required arguments after optional ones 2018-12-10 14:08:20 -05:00
MarcoFalke 5f23460c7e
Merge #14877: rpc: Document default values for optional arguments
fa0c24c96e rpc: Document default values for optional arguments (MarcoFalke)

Pull request description:

Tree-SHA512: e1f5ea67d7ac67526ae87bffaeb308a9ad68632e161fe0148cd431a340bb7a30def18f1dbc7e98c6c1c269ac8942fd5d5334c85c48e4fb1cead70a42536b6eef
2018-12-10 14:02:21 -05:00
MarcoFalke 234b99b921
Merge #14885: rpc: Assert named arguments are unique in RPCHelpMan
e09a5875ca rpc: Assert named arguments are unique in RPCHelpMan (João Barbosa)

Pull request description:

  Prevents an obvious mistake.

Tree-SHA512: 32c24a1934b17ab6f0d5cd31bdf0388e93ee5156ccc1b4f78eb9fd7f1d4b27a4b978b594ff11812bc9f20987c9fc36bf4497ddaedf18cf6bcbea19c050571334
2018-12-10 10:26:39 -05:00
Wladimir J. van der Laan 0eb65aa902
Merge #14801: qt: Use window() instead of obsolete topLevelWidget()
0b4a5786bb Use window() instead of obsolete topLevelWidget() (Hennadii Stepanov)

Pull request description:

  `QWidget::topLevelWidget()` is obsolete since at least Qt 4.8.

  Refs:
  - https://doc-snapshots.qt.io/4.8/qwidget-obsolete.html#topLevelWidget
  - https://doc.qt.io/qt-5.9/qwidget-obsolete.html#topLevelWidget

Tree-SHA512: 45a79a3f11acd24bbf335603e60cb46545f4c9ce9b16280117676797a611c4422525abd39ad6784a7bc459926e3f5120b49a170403ff60ba4788d679862e3ff0
2018-12-09 16:53:55 +01:00
Cory Fields 89282379ba
threads: fix unitialized members in sched_param
Building with gcc 8.2 against musl libc, which apparently has more attributes
available in its sched_param. The following warnings were produced:

    warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

Since the current thread may have interesting non-zero values for these fields,
we want to be sure to only change the intended one. Query and modify the
current sched_param rather than starting from a zeroed one.
2018-12-09 21:08:48 +08:00
MarcoFalke fa0c24c96e
rpc: Document default values for optional arguments 2018-12-07 11:53:29 -05:00
João Barbosa e09a5875ca rpc: Assert named arguments are unique in RPCHelpMan 2018-12-07 16:26:38 +00:00
Wladimir J. van der Laan d38a2c1416
Merge #14890: rpc: Avoid creating non-standard raw transactions
fa4c8679ed rpc: Avoid creating non-standard raw transactions (MarcoFalke)

Pull request description:

  Multiple OP_RETURN outputs in a transaction are not standard and unlikely to be relayed, so avoid creating them.

  Apart from that, the logic was broken in that it duplicated the same hex-data for each data output: Closes #14868.

Tree-SHA512: b08d08062b5622e8a7b497e490ccaf53b06e844c863fda3bf3f932a98684a809e8341aeb98232059a795afb32d8770a6c5591a66f8e6ee372b672af245607887
2018-12-07 17:19:48 +01:00
Wladimir J. van der Laan 2b12268095
Merge #14854: qt: Cleanup SplashScreen class
7d1b60ce93 Cleanup SplashScreen class (Hennadii Stepanov)

Pull request description:

  Cleaning up after replacing the `QSplashScreen` base class with the `QWidget` class (#4941 by @laanwj).

  cc @jonasschnelli

Tree-SHA512: 72e2d67905d85247a11ae6a884f74f710f765adf20db7d1daf0927e6990687e836b486c4ff93bc6dabc3759ed667acfe1d69c8b94fae7181ab271a3fa7a0229a
2018-12-07 17:12:55 +01:00
Wladimir J. van der Laan b8b0b8ced7
Merge #14480: refactor: Drop boost::this_thread::interruption_point and boost::thread_interrupted in main thread
b7df96f456 refactor: Drop boost::this_thread::interruption_point and boost::thread_interrupted in main thread (Chun Kuan Lee)

Pull request description:

  This PR drops useless `boost::this_thread::interruption_point` and `boost::thread_interrupted` catch. They are only executed in main thread.

Tree-SHA512: a980d098c1a8238e4f0da9493731d7e69b9ca8e010103f442722d0d4cce471cc40a1fafd5f05535ad0e18899b6cf7563ee20e4025f7c7bc15182a0058c028922
2018-12-07 15:40:50 +01:00
Wladimir J. van der Laan f544e23556
Merge #14863: refactor: Add and use HaveTxsDownloaded() where appropriate
fa4fc8856b validation: Add and use HaveTxsDownloaded where appropriate (MarcoFalke)

Pull request description:

  `nChainTx` is an implementation detail that shouldn't be exposed without a wrapper that comes with appropriate documentation.

Tree-SHA512: 56ab7378c2ce97794498724c271f861de982de69099e90ec09632a26230ae6fded3c59668adb378bd64dcb8ef714769b970210977b88a53fc7550774ddba3d59
2018-12-07 14:59:30 +01:00
MarcoFalke fa4c8679ed
rpc: Avoid creating non-standard raw transactions 2018-12-06 16:56:58 -05:00
MarcoFalke f8456256c8
Merge #14783: gui: Fix boost::signals2::no_slots_error in early calls to InitWarning
6bbdb2077e squashme: connect thru node interface (João Barbosa)
a0f8df365d qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning (João Barbosa)

Pull request description:

  Adding the following to `bitcoin.conf`
  ```
  [xxx]
  disablewallet=1
  ```
  And running `bitcoin-qt` gives:
  ```
  libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error
  ```

  Fixes regression in #14708.

Tree-SHA512: 7c158376fad6ebcd80fc0dbe549d5b6e893fb82e7dc1e455825633d7f91b14dc34493487cab7642152e88f9eaf99bfa91988972d600e9fb289cf26afd64aff8a
2018-12-06 14:52:18 -05:00
Wladimir J. van der Laan a88bd3186d
Merge #14670: http: Fix HTTP server shutdown
28479f926f qa: Test bitcond shutdown (João Barbosa)
8d3f46ec39 http: Remove timeout to exit event loop (João Barbosa)
e98a9eede2 http: Remove unnecessary event_base_loopexit call (João Barbosa)
6b13580f4e http: Unlisten sockets after all workers quit (João Barbosa)
18e9685816 http: Send "Connection: close" header if shutdown is requested (João Barbosa)
02e1e4eff6 rpc: Add wait argument to stop (João Barbosa)

Pull request description:

  Fixes #11777. Reverts #11006. Replaces #13501.

  With this change the HTTP server will exit gracefully, meaning that all requests will finish processing and sending the response, even if this means to wait more than 2 seconds (current time allowed to exit the event loop).

  Another small change is that connections are accepted even when the server is stopping, but HTTP requests are rejected. This can be improved later, especially if chunked replies are implemented.

  Briefly, before this PR, this is the order or events when a request arrives (RPC `stop`):
   1. `bufferevent_disable(..., EV_READ)`
   2. `StartShutdown()`
   3. `evhttp_del_accept_socket(...)`
   4. `ThreadHTTP` terminates (event loop exits) because there are no active or pending events thanks to 1. and 3.
   5. client doesn't get the response thanks to 4.

  This can be verified by applying
  ```diff
       // Event loop will exit after current HTTP requests have been handled, so
       // this reply will get back to the client.
       StartShutdown();
  +    MilliSleep(2000);
       return "Bitcoin server stopping";
   }
  ```
  and checking the log output:
  ```
      Received a POST request for / from 127.0.0.1:62443
      ThreadRPCServer method=stop user=__cookie__
      Interrupting HTTP server
  **  Exited http event loop
      Interrupting HTTP RPC server
      Interrupting RPC
      tor: Thread interrupt
      Shutdown: In progress...
      torcontrol thread exit
      Stopping HTTP RPC server
      addcon thread exit
      opencon thread exit
      Unregistering HTTP handler for / (exactmatch 1)
      Unregistering HTTP handler for /wallet/ (exactmatch 0)
      Stopping RPC
      RPC stopped.
      Stopping HTTP server
      Waiting for HTTP worker threads to exit
      msghand thread exit
      net thread exit

      ... sleep 2 seconds ...

      Waiting for HTTP event thread to exit
      Stopped HTTP server
  ```

  For this reason point 3. is moved right after all HTTP workers quit. In that moment HTTP replies are queued in the event loop which keeps spinning util all connections are closed. In order to trigger the server side close with keep alive connections (implicit in HTTP/1.1) the header `Connection: close` is sent if shutdown was requested. This can be tested by
  ```
  bitcoind -regtest
  nc localhost 18443
  POST / HTTP/1.1
  Authorization: Basic ...
  Content-Type: application/json
  Content-Length: 44

  {"jsonrpc": "2.0","method":"stop","id":123}
  ```

  Summing up, this PR:
   - removes explicit event loop exit — event loop exits once there are no active or pending events
   - changes the moment the listening sockets are removed — explained above
   - sends header `Connection: close` on active requests when shutdown was requested which is relevant when it's a persistent connection (default in HTTP 1.1) — libevent is aware of this header and closes the connection gracefully
   - removes event loop explicit break after 2 seconds timeout

Tree-SHA512: 4dac1e86abe388697c1e2dedbf31fb36a394cfafe5e64eadbf6ed01d829542785a8c3b91d1ab680d3f03f912d14fc87176428041141441d25dcb6c98a1e069d8
2018-12-06 17:43:07 +01:00
Hennadii Stepanov 93009618b6
Fix start with the -min option
When GUI starts with the `-min` option, the `Minimize to tray instead of
the taskbar` option works as expected now.
2018-12-06 18:23:31 +02:00
Wladimir J. van der Laan 0936e2596b
Merge #14831: Scripts and tools: Use #!/usr/bin/env bash instead of #!/bin/bash.
688f665a5e Scripts and tools & Docs: Used #!/usr/bin/env bash instead of obsolete #!/bin/bash, added linting for .sh files shebang and updated the Developer Notes. (vim88)

Pull request description:

  As it was discussed in [#13510](https://github.com/bitcoin/bitcoin/pull/13510), it is better to use `#!/usr/bin/env bash` instead of `#!/bin/bash`.

Tree-SHA512: 25f71eb9a6a0cdc91568b5c6863205c5fe095f77a69e633503a2ac7805bd9013af8538e538c0c666ce96a28e3f43ce7a8df5f08d4ff007723bb588d85674f2da
2018-12-06 15:47:44 +01:00
Wladimir J. van der Laan 127b30cce8
Merge #14838: Use const in COutPoint class
cf4b0327ed Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1 (practicalswift)
6b82fc59eb Use const in COutPoint class (Hennadii Stepanov)

Pull request description:

  Refactoring:
  - all cases of using `(uint32_t) -1` in `COutPoint` class are replaced with const;
  - also all remaining instances of `(UNSIGNED)-1` transformed to `std::numeric_limits<UNSIGNED>::max()` (by @practicalswift).

Tree-SHA512: fc7fe9838b6e5136d8b97ea3d6f64c4aaa1215f4369832df432cab017396620bb6e30520a64180ceab6de222562ac11eab243a78dfa5a658ba018835a34caa19
2018-12-06 15:37:57 +01:00
practicalswift 8931a95bec Include util/strencodings.h which is required for IsSpace(...) 2018-12-06 12:12:15 +01:00
MarcoFalke e2c473ff75
Merge #14796: rpc: Pass argument descriptions to RPCHelpMan
fabca42c68 RPCHelpMan: Add space after colons in extended description (MarcoFalke)
fafd040f73 rpc: Add description to fundrawtransaction vout_index (MarcoFalke)
1db0096f61 rpc: Pass argument descriptions to RPCHelpMan (MarcoFalke)

Pull request description:

  This will normalize the type names and formatting for the rpc arguments

Tree-SHA512: 6ab344882f0fed36046ab4636cb2fa5d2479c6aae22666ca9a0d067edbb9eff8de98010ad97c8ce40ab532d15d1ae67120a561b0bf3da837090d7de427679f4f
2018-12-05 11:03:49 -05:00
MarcoFalke fabca42c68
RPCHelpMan: Add space after colons in extended description
Also, add doxygen comment to ToDescriptionString
2018-12-04 13:47:49 -05:00
practicalswift cf4b0327ed
Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1 2018-12-04 19:55:04 +02:00
MarcoFalke fafd040f73
rpc: Add description to fundrawtransaction vout_index 2018-12-04 12:06:13 -05:00
MarcoFalke fa4fc8856b
validation: Add and use HaveTxsDownloaded where appropriate 2018-12-04 10:51:56 -05:00
Wladimir J. van der Laan 86ff0413bb
Merge #14840: Remove duplicate libconsensus linking in test make
b14948e2e Remove duplicate libconsensus linking in test make (Amir Abrams)

Pull request description:

  `LIBBITCOIN_CONSENSUS` is linked twice in Makefile.test.include

Tree-SHA512: d4240e6f15f62ec1500021760af5155c6ce3898d1ca8da463ad85e2bff4435aa3b9204505ef889149509ae959d44dd845914671bc3d7df61e89aa3ab5e1aa751
2018-12-04 13:39:35 +01:00
Wladimir J. van der Laan 88445889f1
Merge #14733: P2P: Make peer timeout configurable, speed up very slow test and ensure correct code path tested.
48b37db50 make peertimeout a debug argument, remove error message translation (Zain Iqbal Allarakhia)
8042bbfbf p2p: allow p2ptimeout to be configurable, speed up slow test (Zain Iqbal Allarakhia)

Pull request description:

  **Summary:**

  1. _Primary_: Adds a `debug_only=true` flag for peertimeout, defaults to 60 sec., the current hard-coded setting.
  2. _Secondary_: Drastically speeds up `p2p_timeout.py` test.
  3. _Secondary_: Tests that the correct code path is being tested by adding log assertions to the test.

  **Rationale:**

  - P2P timeout was hard-coded: make it explicitly specified and configurable, instead of a magic number.
  - Addresses #13518; `p2p_timeout.py` takes 4 sec. to run instead of 61 sec.
  - Makes `p2p_timeout.py` more explicit. Previously, we relied on a comment to inform us of the timeout amount being tested. Now it is specified directly in the test via passing in the new arg; `-peertimeout=3`.
  - Opens us up to testing more P2P scenarios; oftentimes slow tests are the reason we don't test.

  **Locally verified changes:**

  _With Proposed Change (4.7 sec.):_
  ```
  $ time ./test/functional/p2p_timeouts.py
  2018-11-19T00:04:19.077000Z TestFramework (INFO): Initializing test directory /tmp/testhja7g2n7
  2018-11-19T00:04:23.479000Z TestFramework (INFO): Stopping nodes
  2018-11-19T00:04:23.683000Z TestFramework (INFO): Cleaning up /tmp/testhja7g2n7 on exit
  2018-11-19T00:04:23.683000Z TestFramework (INFO): Tests successful

  real    0m4.743s
  ```

  _Currently  on master (62.8 sec.):_
  ```
  $ time ./test/functional/p2p_timeouts.py
  2018-11-19T00:06:10.948000Z TestFramework (INFO): Initializing test directory /tmp/test6mo6k21h
  2018-11-19T00:07:13.376000Z TestFramework (INFO): Stopping nodes
  2018-11-19T00:07:13.631000Z TestFramework (INFO): Cleaning up /tmp/test6mo6k21h on exit
  2018-11-19T00:07:13.631000Z TestFramework (INFO): Tests successful

  real    1m2.836s
  ```

  _Error message demonstrated for new argument `-peertimeout`:_
  ```
  $ ./bitcoind -peertimeout=-5
  ...
  Error: peertimeout cannot be configured with a negative value.
  ```

Tree-SHA512: ff7a244ebea54c4059407bf4fb86465714e6a79cef5d2bcaa22cfe831a81761aaf597ba4d5172fc2ec12266f54712216fc41b5d24849e5d9dab39ba6f09e3a2a
2018-12-04 12:58:02 +01:00
Wladimir J. van der Laan c789add6fc
Merge #14760: Log env path in BerkeleyEnvironment::Flush
467461030 Log env path in BerkeleyEnvironment::Flush (João Barbosa)

Pull request description:

  With `bitcoind -regtest -wallet=w1 -wallet=w2 -debug`, before:

  ```
  BerkeleyEnvironment::Flush: Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              23ms
  BerkeleyEnvironment::Flush: Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              19ms
  ```

  After:
  ```
  BerkeleyEnvironment::Flush: [/Users/joao/Library/Application Support/Bitcoin/regtest/wallets/w1] Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              23ms
  BerkeleyEnvironment::Flush: [/Users/joao/Library/Application Support/Bitcoin/regtest/wallets/w2] Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              19ms
  ```

Tree-SHA512: f90b413cca5d2527324a264ce371dc8baba69f5b541f7d7f6238a8dd79398cbd3c67c0d7a8a0b69aec6c44d77ba26a079c2241427e3669ed22c7da0e4d60039e
2018-12-04 11:34:43 +01:00
Jonas Schnelli 64fc7c0c1b
Merge #14828: qt: Remove hidden columns in coin control dialog
1c28feb7d qt: Remove hidden columns in coin control dialog (João Barbosa)

Pull request description:

  Instead of having hidden columns, store the data in specific roles.

  Overlaps with #14817, fixes #11811.

Tree-SHA512: e86e9ca426b9146ac28997ca1920dbae6cc4e2e494ff94fe131d605cd6c013183fc5de10036c886a4d6dcae497ac4067de3791be0ef9c88f7ce9f57f7bd97422
2018-12-04 09:19:56 +01:00
Patrick Strateman 4927bf2f25 Increase maxconnections limit when using poll. 2018-12-03 14:25:55 -05:00
Patrick Strateman 11cc491a28 Implement poll() on systems which support it properly.
This eliminates the restriction on maximum socket descriptor number.
2018-12-03 14:25:51 -05:00
practicalswift dae1423e5a Add locking annotations to feeStats, shortStats and longStats 2018-12-03 00:14:33 +01:00
practicalswift 764e42fee2 scripted-diff: Rename from cs_feeEstimator to m_cs_fee_estimator
-BEGIN VERIFY SCRIPT-
sed -i 's/cs_feeEstimator/m_cs_fee_estimator/' src/policy/fees.cpp src/policy/fees.h
-END VERIFY SCRIPT-
2018-12-02 21:18:04 +01:00
practicalswift 9a789d4dc6 policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator 2018-12-02 21:18:04 +01:00
vim88 688f665a5e Scripts and tools & Docs: Used #!/usr/bin/env bash instead of obsolete #!/bin/bash, added linting for .sh files shebang and updated the Developer Notes. 2018-12-02 16:14:21 +02:00
Hennadii Stepanov 7d1b60ce93
Cleanup SplashScreen class
Cleaning up after replacing the QSplashScreen base class with the
QWidget class.
2018-12-02 01:26:28 +02:00
andrewtoth e982f0b682 Add all category options to wallet rpc help 2018-12-01 13:00:00 -05:00
Wladimir J. van der Laan ed12fd83ca
Merge #13966: gui: When private key is disabled, only show watch-only balance
82d6c5aad gui: Show watch-only eye instead of HD disabled (Chun Kuan Lee)
fe1ff5026 Hide spendable label if priveate key is disabled (Chun Kuan Lee)

Pull request description:

  If a wallet is in private key disabled mode, the spendable balance is always zero, it does not have to show on GUI. Show the watch-only balance at normal balance column if a wallet is in that mode.

  ![image](https://user-images.githubusercontent.com/11154118/45662527-dfaab400-bb34-11e8-98c8-c06ac5c0b08a.png)

Tree-SHA512: 8b535427d26d3f8e61081f50e4773bd25656be042d378fd34cf647e9a0065cb4dfb67a8ab9fb4fbf5f196390df8cb983ebf2f0fa8a6503b7c046c56bec87ba72
2018-12-01 12:24:33 +01:00
Wladimir J. van der Laan 5ab5341d13
Merge #14841: consensus: Move CheckBlock() call to critical section
c5ed6e73d Move CheckBlock() call to critical section (Hennadii Stepanov)

Pull request description:

  This is an alternative to #14803.

  Refs:
  - #14058
  - #14072
  - https://github.com/bitcoin/bitcoin/pull/14803#issuecomment-442233211 by @gmaxwell
  > It doesn't support multithreaded validation and there are lot of things that prevent that, which is why I was concerned. Why doesn't the lock on the block index or even cs main prevent concurrency here?

  - https://github.com/bitcoin/bitcoin/pull/14803#issuecomment-442237566 by @MarcoFalke

Tree-SHA512: 2152e97106e11da5763b2748234ecd2982daadab13a0da04215f4db60af802a44ab5700f32249137d122eb13fc2a02e0f2d561d364607d727d8c6ab879339afb
2018-12-01 10:27:49 +01:00
Patrick Strateman 28211a4bc9 Move SocketEvents logic to private method.
This separates the select() logic from the socket handling logic, setting up
for a switch to poll().
2018-11-30 18:02:51 -05:00
Patrick Strateman 7e403c0ae7 Move GenerateSelectSet logic to private method.
This separates the socket event collection logic from the logic
deciding which events we're interested in at all.
2018-11-30 18:02:51 -05:00
Patrick Strateman 1e6afd0dbc Introduce and use constant SELECT_TIMEOUT_MILLISECONDS. 2018-11-30 18:02:51 -05:00
Wladimir J. van der Laan 011c42c5bd
Merge #13258: uint256: Remove unnecessary crypto/common.h dependency
bf2e01097 uint256: Remove unnecessary crypto/common.h use (Karl-Johan Alm)

Pull request description:

  This is an alternative to #13242 which keeps the `ReadLE64` part, but moves the `crypto/common.h` dependency into `crypto/common.h` as a function outside of `uint256`.

  **Reason:** this change will remove dependencies for `uint256` to `crypto/common.h`, `compat/endian.h`, and `compat/byteswap.h`.

  This PR removes the need to update tests to be endian-aware/-independent, but keeps the (arguably dubious) `ReadLE64` part (which was only introduced to fix the tests, not for any functionality).

Tree-SHA512: 78b35123cdb185b3b3ec59aba5ca8a5db72624d147f2d6a5484ffa5ce626a72f782a01dc6893fc8f5619b03e2eae7b5a03b0df5d43460f3bda428e719e188aec
2018-11-30 18:48:58 +01:00
MarcoFalke 13a7454fbd
Merge #14380: fix assert crash when specified change output spend size is unknown
0fb2e69815 CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change (Gregory Sanders)
b06483c96a Remove stale comment in CalculateMaximumSignedInputSize (Gregory Sanders)

Pull request description:

  This is triggered anytime a fundraw type call(psbt or legacy) is used with a change output address that the wallet doesn't know how to sign for.

  This regression was added in 6a34ff5335 since BnB coin selection actually cares about this.

  The fix is to assume the smallest typical spend, a P2SH-P2WPKH, which is calculated using a "prototype" dummy signature flow. Future work could generalize this infrastructure to get estimated sizes of inputs for a variety of types.

  I also removed a comment which I believe is stale and misleading.

Tree-SHA512: c7e2be189e524f81a7aa4454ad9370cefba715e3781f1e462c8bab77e4d27540191419029e3ebda11e3744c0703271e479dcd560d05e4d470048d9633e34da16
2018-11-30 10:49:49 -05:00
Hennadii Stepanov 6b82fc59eb
Use const in COutPoint class 2018-11-30 12:54:24 +02:00
Hennadii Stepanov c5ed6e73d3
Move CheckBlock() call to critical section
This prevents data race for CBlock::fChecked.
2018-11-30 12:40:57 +02:00
Zain Iqbal Allarakhia 48b37db50f make peertimeout a debug argument, remove error message translation 2018-11-29 13:05:41 -08:00
Amir Abrams b14948e2e0
Remove duplicate libconsensus linking in test make
LIBBITCOIN_CONSENSUS is linked twice in Makefile.test.include
2018-11-29 05:30:58 -06:00
João Barbosa 1c28feb7d0 qt: Remove hidden columns in coin control dialog 2018-11-29 07:58:40 +00:00
Karl-Johan Alm fbaaf782ce
validation: assert that pindexPrev is non-null when required 2018-11-29 14:15:39 +09:00
Zain Iqbal Allarakhia 8042bbfbf0 p2p: allow p2ptimeout to be configurable, speed up slow test 2018-11-28 16:41:15 -08:00
Pieter Wuille 26879509f1 Add comments to descriptor tests 2018-11-28 15:24:49 -08:00
Pieter Wuille 82df4c64ff Add descriptor expansion cache 2018-11-28 15:24:49 -08:00
Pieter Wuille 1eda33aabc [refactor] Combine the ToString and ToPrivateString implementations 2018-11-28 15:24:49 -08:00
Pieter Wuille 24d3a7b3a9 [refactor] Use DescriptorImpl internally, permitting access to new methods 2018-11-28 15:24:49 -08:00
Pieter Wuille 6be0fb4b3f [refactor] Add a base DescriptorImpl with most common logic 2018-11-28 15:16:17 -08:00
MarcoFalke 60b20c869f
Merge #14822: bench: Destroy wallet txs instead of leaking their memory
fa5cef0f78 bench: Destroy wallet txs instead of leaking their memory (MarcoFalke)

Pull request description:

  This should destroy the wallet txs when the benchmark ends to avoid having to hold them when the following benchmarks run.

Tree-SHA512: e2510946e6a47fad3ec5fb28d298df8ddc2e017455fcff777fa7bbc12d801c08739db6a7a7289509aaa881ccdc59dfff9bcb6772b48db2c457d3787081a46c06
2018-11-28 11:14:03 -05:00
practicalswift 4894133dc5 Add missing lock in CNode::copyStats(...) 2018-11-28 09:36:25 +01:00
practicalswift b312cd7707 Add missing locking annotations 2018-11-28 09:36:25 +01:00
MarcoFalke fa5cef0f78
bench: Destroy wallet txs instead of leaking their memory 2018-11-27 16:52:56 -05:00
Pieter Wuille 0e75f44a09 Replace CAffectedKeysVisitor with descriptor based logic 2018-11-27 12:23:49 -08:00
Pieter Wuille fdf146f329
Merge #14477: Add ability to convert solvability info to descriptor
109699dd33 Add release notes (Pieter Wuille)
b65326b562 Add matching descriptors to scantxoutset output + tests (Pieter Wuille)
16203d5df7 Add descriptors to listunspent and getaddressinfo + tests (Pieter Wuille)
9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable (Pieter Wuille)
225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others (Pieter Wuille)
4d78bd93b5 Add support for inferring descriptors from scripts (Pieter Wuille)

Pull request description:

  This PR adds functionality to convert a script to a descriptor, given a `SigningProvider` with the relevant information about public keys and redeemscripts/witnessscripts.

  The feature is exposed in `listunspent`, `getaddressinfo`, and `scantxoutset` whenever these calls are applied to solvable outputs/addresses.

  This is not very useful on its own, though when we add RPCs to import descriptors, or sign PSBTs using descriptors, these strings become a compact and standalone way of conveying everything necessary to sign an output (excluding private keys).

  Unit tests and rudimentary RPC tests are included (more relevant tests can be added once RPCs support descriptors).

  Fixes #14503.

Tree-SHA512: cb36b84a3e0200375b7e06a98c7e750cfaf95cf5de132cad59f7ec3cbd201f739427de0dc108f515be7aca203652089fbf5f24ed283d4553bddf23a3224ab31f
2018-11-27 12:22:41 -08:00
MarcoFalke 0fa3703c17
Merge #14820: test: Fix descriptor_tests not checking ToString output of public descriptors
c77f09230b Fix descriptor_tests not checking ToString output of public descriptors (Russell Yanofsky)

Pull request description:

  This fixes a minor test bug introduced in #13697 that I noticed while reviewing #14646

Tree-SHA512: efed91200cdff5f86ba5de3461ac00759d285e2905f6cb24cea15d3e23e0581ce5fc14b24a40db093f7ebd662ee1ee2cf67f8798bac1903a78298eda08909cfb
2018-11-27 15:09:59 -05:00
Russell Yanofsky c77f09230b Fix descriptor_tests not checking ToString output of public descriptors 2018-11-27 14:44:23 -05:00
MarcoFalke 1db0096f61 rpc: Pass argument descriptions to RPCHelpMan 2018-11-27 14:18:19 -05:00
MarcoFalke 8c119b2755
Merge #14813: qa: Add wallet_encryption error tests
fa739d4bd7 qa: Add wallet_encryption error tests (MarcoFalke)

Pull request description:

  The errors for empty passphrases are the help text of the RPC call, which is not very specific. Replace that with proper RPC errors and test them.

Tree-SHA512: 3137e0f8f2e42a1f8ab1eeb57c99052557725f6f85139ff48c24acc8f3cf4087802de5216f3ce97375b291d21bddb7cd1379a6f280166136a306a0c9663bbd42
2018-11-27 13:54:23 -05:00
MarcoFalke d491030076
Merge #14772: refactor: Convert comments to thread safety annotations
fa71eb5196 Convert comments to thread safety annotations (MarcoFalke)

Pull request description:

  Convert human-only-readable annotations to human-and-machine-readable annotations.

Tree-SHA512: 98a97b32b50e8ec816626ed853d56c9afb31065eb14f058cda8f22a16ddd2b0c02911f9e30478aa347f466891f972496d89a828eb6e4662fb712d7d9e7643d49
2018-11-27 12:43:37 -05:00
MarcoFalke fa739d4bd7
qa: Add wallet_encryption error tests 2018-11-26 16:12:13 -05:00
Pierre Rochard 14bc2a17dd Trivial: add doxygen-compatible comments relating to BerkeleyEnvironment 2018-11-26 12:20:35 -04:00
Pierre Rochard 88b1d956fe Tests: add unit tests for GetWalletEnv 2018-11-26 12:20:35 -04:00
Russell Yanofsky f1f4bb7345 Free BerkeleyEnvironment instances when not in use
Instead of adding BerkeleyEnvironment objects permanently to the g_dbenvs map,
use reference counted shared pointers and remove map entries when the last
BerkeleyEnvironment reference goes out of scope.

This change was requested by Matt Corallo <git@bluematt.me> and makes code that
sets up mock databases cleaner. The mock database environment will now go out
of scope and be reset on destruction so there is no need to call
BerkeleyEnvironment::Reset() during wallet construction to clear out prior
state.

This change does affect bitcoin behavior slightly. On startup, instead of same
wallet environments staying open throughout VerifyWallets() and OpenWallets()
calls, VerifyWallets() will open and close an environment once for each wallet,
and OpenWallets() will create its own environment(s) later.
2018-11-26 12:20:35 -04:00
Jameson Lopp 848077f94d
clarify RPC rawtransaction documentation 2018-11-26 09:58:29 -05:00
Hennadii Stepanov 0b4a5786bb
Use window() instead of obsolete topLevelWidget() 2018-11-25 11:32:59 +02:00
Ben Woosley 4a86a0acd9
Make SafeDbt DB_DBT_MALLOC on default initialization
If we're constructing the SafeDbt without provided data, it is always malloced,
so that is the case we expose.

Also run clang-format.
2018-11-24 21:05:48 -06:00
Jeremy Rubin e4eee7d09d Add Benchmark to test input de-duplication worst case
Fix nits

replace utiltime?
2018-11-25 10:53:20 +09:00
João Barbosa 6bbdb2077e squashme: connect thru node interface 2018-11-24 22:16:26 +00:00
Carl Dong dcb70b1522 Indicate -rpcauth option password hashing alg 2018-11-24 12:33:23 -08:00
João Barbosa 8d3f46ec39 http: Remove timeout to exit event loop
Let HTTP connections to timeout due to inactivity.
Let all remaning connections finish sending the response and close.
2018-11-23 16:54:22 +00:00
João Barbosa e98a9eede2 http: Remove unnecessary event_base_loopexit call
Let event base loop exit cleanly by processing all active and pending
events. The call is no longer necessary because closing persistent
connections is now properly handled.
2018-11-23 16:54:22 +00:00
João Barbosa 6b13580f4e http: Unlisten sockets after all workers quit
This (almost) move only ensures the event base loop doesn't exit before
HTTP worker threads exit. This way events registered by HTTP workers are
processed and not discarded.
2018-11-23 16:54:22 +00:00
João Barbosa 18e9685816 http: Send "Connection: close" header if shutdown is requested
Sending the header "Connection: close" makes libevent close persistent
connections (implicit with HTTP 1.1) which cleans the event base when
shutdown is requested.
2018-11-23 16:54:22 +00:00
João Barbosa 02e1e4eff6 rpc: Add wait argument to stop 2018-11-23 16:54:22 +00:00
practicalswift 958e1a307e streams: Remove unused seek(size_t) 2018-11-23 16:58:44 +01:00
Hennadii Stepanov 7514361254
Correct misleading "overridden options" label
Command-line options override values set in the configuration file and
configuration file options override values set in the GUI.
2018-11-23 15:40:16 +02:00
Wladimir J. van der Laan 59f05d1161
Merge #14521: qt, docs: Fix bitcoin-qt -version output formatting
60ae463a68 Fix `bitcoin-qt -version` output formatting (Hennadii Stepanov)

Pull request description:

  This PR makes command line output of `bitcoin-qt -version` formatted in the same way as `bitcoind -version` output.

  Before:
  ![screenshot from 2018-10-19 20-16-42](https://user-images.githubusercontent.com/32963518/47233718-434a2a80-d3dc-11e8-90d4-84dd23e8ac3b.png)

  After:
  ![screenshot from 2018-10-19 20-22-09](https://user-images.githubusercontent.com/32963518/47233888-b653a100-d3dc-11e8-9155-000b517a8e7b.png)

Tree-SHA512: fd8bd20e2108b9562bcbf6c094f950e867a5755994e8acc28b07e52fe73d04f783201c20bde47be2083ce89fb3ef9749f9c3757d479ad6c48ed09c633155f47e
2018-11-23 10:17:46 +01:00
Wladimir J. van der Laan 0595164dba
Merge #14678: [wallet] remove redundant KeyOriginInfo access, already done in CreateSig
b81a186056 GetPubKey: make sigdata const (Gregory Sanders)
f7beb95a1f remove redundant KeyOriginInfo access, already done in CreateSig (Gregory Sanders)

Pull request description:

  This redundancy is confusing as it looks like pubkeyhashes are special in some way based on where it's called.

Tree-SHA512: a980b7c774c6d69322945227a2b156489fb1991ebf57fe6f26096d5f8047f246a133debc241b05af67810f604b040079add3ab3d30d9e2928095905a2afe17eb
2018-11-23 10:13:03 +01:00
Wladimir J. van der Laan e3a1b74cdf
Merge #14448: doc: Clarify rpcwallet flag url change
0c69ff6171 clarify rpcwallet flag url change (Jordan Baczuk)

Pull request description:

  This adds clarification to the bitcoin-cli -rpcwallet flag in the help command. This will benefit users who want to utilize this feature without the cli, for example curl. It isn't readily apparent that this changes the url used in the RPC call.

Tree-SHA512: 6fc759f193f0a918884aab8ba4dc77ed9e89ee3840feeff737a754be758750590f5bd44b40f4810c3b82601e125e62e10360af45cb8e9d95be206ebeb9120ebf
2018-11-23 09:58:48 +01:00
Wladimir J. van der Laan 2479b779aa
Merge #14728: fix uninitialized read when stringifying an addrLocal
b7b36decaf fix uninitialized read when stringifying an addrLocal (Kaz Wesley)
8ebbef0169 add test demonstrating addrLocal UB (Kaz Wesley)

Pull request description:

  Reachable from either place where SetIP is used when all of:
  - our best-guess addrLocal for a peer is IPv4
  - the peer tells us it's reaching us at an IPv6 address
  - NET logging is enabled

  In that case, SetIP turns an IPv4 address into an IPv6 address without
  setting the scopeId, which is subsequently read in GetSockAddr during
  CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
  constructor initializes the scopeId field with something.

Tree-SHA512: 8f0159750995e08b985335ccf60a273ebd09003990bcf2c3838b550ed8dc2659552ac7611650e6dd8e29d786fe52ed57674f5880f2e18dc594a7a863134739e3
2018-11-23 09:53:20 +01:00
Wladimir J. van der Laan a0d86815cd
Merge #14726: Use RPCHelpMan for all RPCs
fa5e0452e8 rpc: Documentation fixups (MarcoFalke)
fa91e8eda5 Use RPCHelpMan for all RPCs (MarcoFalke)
fa520e72f7 lint: Must use RPCHelpMan to generate the RPC docs (MarcoFalke)

Pull request description:

  The resulting documentation should not change unless the type in the oneline-summary was previously incorrect. (E.g. string vs bool)

Tree-SHA512: 4ff355b6a53178f02781e97a7aca7ee1d0d97ff348b6bf5a01caa1c96904ee33c704465fae54c2cd7445097427fd04c71ad3779bb7a7ed886055ef36c1b5a1d0
2018-11-23 09:42:33 +01:00
João Barbosa a0f8df365d qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning 2018-11-22 17:41:01 +00:00
MarcoFalke 2a97f192ea
Merge #14771: test: Add BOOST_REQUIRE to getters returning optional
fa21ca09a8 test: Add BOOST_REQUIRE to getters returning optional (MarcoFalke)

Pull request description:

  Usually the returned value is already checked for equality, but for sanity we might as well require that the getter successfully returned.

Tree-SHA512: 0d613a9a721c61bd7a115ebc681a0890df09b8e5775f176ac18b3a586f2ca57bee0b5b816f5a7c314ff3ac6cbb2a4d9c434f8459e054a7c8a6934a75f0120c2a
2018-11-22 11:37:17 -05:00
Wladimir J. van der Laan e77a2258e4
Merge #14532: Never bind INADDR_ANY by default, and warn when doing so explicitly
27c44ef9c6 rpcbind: Warn about exposing RPC to untrusted networks (Luke Dashjr)
d6a1287481 CNetAddr: Add IsBindAny method to check for INADDR_ANY (Luke Dashjr)
3615003952 net: Always default rpcbind to localhost, never "all interfaces" (Luke Dashjr)

Pull request description:

  A disturbingly large number of listening nodes appear to be also exposing their RPC server to the public internet. To attempt to mitigate this:

  * Only ever bind localhost by default, even if `rpcallowip` is specified. (A warning is given if `rpcallowip` is specified without `rpcbind`, since it doesn't really make sense to do.)
  * Warn about exposing the RPC server to untrusted networks if the user explicitly binds to any INADDR_ANY address.
  * Include a warning about untrusted networks in the `--help` documentation for `rpcbind`.

Tree-SHA512: 755bbca3db416a31393672eccf6675a5ee4d1eb1812cba73ebb4ff8c6b855ecc5df4c692566e9aa7b0f7d4dce6fedb9c0e9f3c265b9663aca36c4a6ba5efdbd4
2018-11-22 10:53:16 +01:00
Wladimir J. van der Laan e736b67467
Merge #14715: Drop defunct prevector compat handling
69ca48717c Implement prevector::fill once (Ben Woosley)
7bad78c2c8 Drop defunct IS_TRIVIALLY_CONSTRUCTIBLE handling from prevector.h (Ben Woosley)

Pull request description:

  This is clean-up post #14651:
  * Use one implementation of `prevector::fill`, as it's possible now that the implementations are identical.
  * Only apply the `IS_TRIVIALLY_CONSTRUCTIBLE` handling to the bench file where it is used, and drop the now-unnecessary associated compat includes.

Tree-SHA512: 5930b3a17fccd39af10add40202ad97a297aebecc049af72ca920d0d55b3e4c3c30ce864c8a683355895f0196396d4ea56ba9f9637bdc7d16964cdf66c195485
2018-11-22 10:50:38 +01:00
Luke Dashjr 27c44ef9c6 rpcbind: Warn about exposing RPC to untrusted networks 2018-11-22 01:44:59 +00:00
Luke Dashjr d6a1287481 CNetAddr: Add IsBindAny method to check for INADDR_ANY 2018-11-22 01:44:59 +00:00
Luke Dashjr 3615003952 net: Always default rpcbind to localhost, never "all interfaces"
We don't support binding to untrusted networks, so avoid a default where that is typical
2018-11-22 01:44:59 +00:00
Wladimir J. van der Laan d7b0258ff0
Merge #14708: Warn unrecognised sections in the config file
3fb09b9889 Warn unrecognized sections in the config file (Akio Nakamura)

Pull request description:

  This PR intends to resolve #14702.

  In the config file, sections are specified by square bracket pair "[]"$,
  or included in the option name itself which separated by a period"(.)".

  Typicaly, [testnet] is not a correct section name and specified options
  in that section are ignored but user cannot recognize what is happen.

  So, add some log-warning messages if unrecognized section names are
  present in the config file after checking section only args.

  note: Currentry, followings are out of scope of this PR.
  1) Empty section name or option name can describe.
  e.g. [] , .a=b, =c
  2) Multiple period characters can exist in the section name and option name.
  e.g. [c.d.e], [..], f.g.h.i=j, ..=k

Tree-SHA512: 2cea02a0525feb40320613989a75cd7b7b1bd12158d5e6f3174ca77e6a25bb84425dd8812f62483df9fc482045c7b5402d69bc714430518b1847d055a2dc304b
2018-11-21 19:37:22 +01:00
MarcoFalke fa71eb5196
Convert comments to thread safety annotations 2018-11-20 20:29:16 -05:00
MarcoFalke fa21ca09a8
test: Add BOOST_REQUIRE to getters returning optional 2018-11-20 19:51:49 -05:00
Wladimir J. van der Laan afa506f6eb
Merge #14552: wallet: detecting duplicate wallet by comparing the db filename.
591203149f wallet: Create IsDatabaseLoaded function (Chun Kuan Lee)
15c93f075a wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. (Chun Kuan Lee)
c456fbd8df Refactor: Move m_db pointers into BerkeleyDatabase (Russell Yanofsky)

Pull request description:

  Fix #14538

  Fix crash attempting to load the same wallet with different path strings that resolve to the same absolute path. The primary check which prevents loading the same wallet twice is:

  6b8d0a2164/src/wallet/db.cpp (L44)

  But this check is skipped if both wallet paths resolve to the same absolute path, due to caching here:

  6b8d0a2164/src/wallet/db.cpp (L467)

  Meanwhile a secondary check for duplicate wallets is not reliable because it based on a literal comparison, instead of comparison using absolute paths:

  6b8d0a2164/src/wallet/wallet.cpp (L3853)

  This PR fixes the latter check to compare the absolute path of a new wallet being loaded to absolute paths of wallets already loaded, so there should no longer be any way to load the same wallet more than once.

Tree-SHA512: 2fa01811c160b57be3b76c6b4983556a04bbce71a3f8202429987ec020664a062e897deedcd9248bc04e9baaa2fc7b464e2595dcaeff2af0818387bf1fcdbf6f
2018-11-20 15:15:59 +01:00
Akio Nakamura 3fb09b9889 Warn unrecognized sections in the config file
In the config file, sections are specified by square bracket pair "[]"$,
or included in the option name itself which separated by a period"(.)".

Typicaly, [testnet] is not a correct section name and specified options
in that section are ignored but user cannot recognize what is happen.

So, add some log/stderr-warning messages if unrecognized section names
are present in the config file after checking section only args.
2018-11-20 18:28:16 +09:00
Karl-Johan Alm e816b341ab
revert removal of fstream.hpp header in fs.h
This is required for some architectures.
2018-11-20 14:41:12 +09:00
MarcoFalke 09f1d7fe72
Merge #14718: Remove unreferenced boost headers
c54e5a41c4 Remove unreferenced boost headers (Murray Nesbitt)

Pull request description:

  Building with clang (e.g. on FreeBSD) is very noisy due to `-Wthread-safety-analysis` warnings regarding boost. This change removes a number of unnecessary boost includes, and silences the rest of the warnings when building with clang. This allows more potentially interesting warnings to surface from the noise.

  Tested on FreeBSD 11.2

Tree-SHA512: 5e6a0623188b9be59aeae52866799aefb4c3c9ab5e569b07ee8d43fc92e0b5f1f76b96bb54c35c7043148df84641b4a96927fb71f6eb00460c20cd19cf250900
2018-11-19 13:50:16 -05:00
João Barbosa 4674610300 Log env path in BerkeleyEnvironment::Flush 2018-11-19 16:02:06 +00:00
Wladimir J. van der Laan 6d58a5c3b0
Merge #14685: fix a deserialization overflow edge case
b08af10fb2 disallow oversized CBlockHeaderAndShortTxIDs (Kaz Wesley)
6bed4b374d fix a deserialization overflow edge case (Kaz Wesley)
051faf7e9d add a test demonstrating an overflow in a deserialization edge case (Kaz Wesley)

Pull request description:

  A specially-constructed BlockTransactionsRequest can cause `offset` to wrap in deserialization. In the current code, there is not any way this could be dangerous; but disallowing it reduces the potential for future surprises.

Tree-SHA512: 1aaf7636e0801a905ed8807d0d1762132ac8b4421a600c35fb6d5e5033c6bfb587d8668cd9f48c7a08a2ae793a677b7649661e3ae248ab4f8499ab7b6ede483c
2018-11-18 10:15:18 +01:00
Murray Nesbitt c54e5a41c4 Remove unreferenced boost headers 2018-11-16 03:20:44 +00:00
Kaz Wesley b7b36decaf fix uninitialized read when stringifying an addrLocal
Reachable from either place where SetIP is used when our best-guess
addrLocal for a peer is IPv4, but the peer tells us it's reaching us at
an IPv6 address.

In that case, SetIP turns an IPv4 address into an IPv6 address without
setting the scopeId, which is subsequently read in GetSockAddr during
CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
constructor initializes the scopeId field with something.
2018-11-15 13:47:53 -08:00
Kaz Wesley 8ebbef0169 add test demonstrating addrLocal UB 2018-11-15 13:47:53 -08:00
MarcoFalke 384967f311
Merge #13815: util: Add [[nodiscard]] to all {Decode,Parse}[...](...) functions returning bool
9cc0230cfc Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. (practicalswift)
579497e77a tests: Explicitly ignore the return value of DecodeBase58(...) (practicalswift)
145fe95ec7 tests: Check return value of ParseParameters(...) (practicalswift)
7c5bc2a523 miner: Default to DEFAULT_BLOCK_MIN_TX_FEE if unable to parse -blockmintxfee (practicalswift)

Pull request description:

  Changes in this PR:
  * ~~Add linter to make sure the return value of `Parse[...](...)` is checked~~
  * Add `__attribute__((warn_unused_result))` to all `{Decode,Parse}[...](...)` functions returning `bool`
  * Fix violations

  Context:
  * #13712: `wallet: Fix non-determinism in ParseHDKeypath(...). Avoid using an uninitialized variable in path calculation.` would have been prevented by this

Tree-SHA512: 41a97899f2d5a26584235fa02b1ebfb4faacd81ea97e927022955a658fa7e15d07a1443b4b7635151a43259a1adf8f2f4de3c1c75d7b5f09f0d5496463a1dae6
2018-11-15 14:39:37 -05:00
MarcoFalke fa5e0452e8
rpc: Documentation fixups 2018-11-15 12:19:11 -05:00
Pieter Wuille b65326b562 Add matching descriptors to scantxoutset output + tests 2018-11-14 14:21:42 -08:00
Pieter Wuille 16203d5df7 Add descriptors to listunspent and getaddressinfo + tests 2018-11-14 14:21:42 -08:00
MarcoFalke fa91e8eda5
Use RPCHelpMan for all RPCs 2018-11-14 15:33:15 -05:00
Ben Woosley 69ca48717c
Implement prevector::fill once
Now that the implementation is identical, we can use a default value to
distinguish them.
2018-11-14 12:19:28 -05:00
Ben Woosley 7bad78c2c8
Drop defunct IS_TRIVIALLY_CONSTRUCTIBLE handling from prevector.h
It's now only referenced from the bench, so leave it there. This allows us to
drop the associated includes as well.
2018-11-14 12:19:04 -05:00
MarcoFalke e74649e951
Merge #14411: [wallet] Restore ability to list incoming transactions by label
da427dbd48 Rename ListTransactions filter variable (Russell Yanofsky)
65b740f92b [wallet] Restore ability to list incoming transactions by label (Russell Yanofsky)

Pull request description:

  This change partially reverts #13075 and #14023.

  Fixes #14382

Tree-SHA512: 8c4e56104b3a45784cdc06bae8e5facdfff04fe3545b63a35e0ec2e440a41b79d84833ca4c4e728d8af7ebb8a519303a9eda7bee4bbfb92bd50c58587a33eb30
2018-11-14 11:59:41 -05:00
MarcoFalke c7366d2399
Merge #14478: Show error to user when corrupt wallet unlock fails
b4f6e58ca5 Better error message for user when corrupt wallet unlock fails (MeshCollider)

Pull request description:

  Mentioned here: https://github.com/bitcoin/bitcoin/issues/14461#issuecomment-429183503

  Current behavior is to assert(false) and crash, only info is printed in the log. This shows the message to the user before abort() instead.

Tree-SHA512: 526f9ed9262257fca55caf7153ab913ed958b13b079d2f01db797485614d8c375815a1554276e8cf73d3838104b2691a9cf85c8d097973127ae8de9e111446bf
2018-11-14 11:27:01 -05:00
Hennadii Stepanov 2bc3f114d0
Bump the minimum Qt version to 5.2 2018-11-14 01:32:51 +02:00
Russell Yanofsky da427dbd48 Rename ListTransactions filter variable
Suggested by MeshCollider <dobsonsa68@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/14411#discussion_r232134086
2018-11-13 16:49:23 -05:00
MarcoFalke 8c59bb85f9
Merge #14720: rpc: Correctly name arguments
fa0815c300 rpc: Correctly name arguments (Jon Layton)

Pull request description:

  Consistently use the same name to describe arguments in the documentation and add a test that uses the name.

  By splitting it up, the changes are easier to potentially backport and also make review easier when we switch to `RPCHelpMan`.

  The tests should pass with or without the changes in `src`.

  Partly stolen from #14459 (More RPC help description fixes by ch4ot1c)

Tree-SHA512: 1072992b1e93ac41006613523e54a0a8004f529fcb101eb9d74d91474abb0945a5a7539f249905151b904b87448f9efc0cacbd9e052fbe2ea9111e62f3e7249c
2018-11-13 16:49:23 -05:00
Russell Yanofsky 65b740f92b [wallet] Restore ability to list incoming transactions by label
This change partially reverts #13075 and #14023.

Fixes #14382
2018-11-13 17:49:23 -04:00
Kaz Wesley b08af10fb2 disallow oversized CBlockHeaderAndShortTxIDs
Otherwise we'd reply with a bogus BlockTransactionsRequest trying to
request indexes with overflowed deltas.
2018-11-13 12:41:41 -08:00
Wladimir J. van der Laan f617e05c38
Merge #14679: importmulti: Don't add internal addresses to address book
7afddfa8ce importmulti: Don't add internal addresses to address book (Gregory Sanders)

Pull request description:

  Currently anything imported with `internal` will not be treated as change since checking the address book is a primary test of this.

  Added basic tests of all combinations of arguments and change identification.

  Resolves https://github.com/bitcoin/bitcoin/issues/14662

Tree-SHA512: a1f08dc624a3fadee93cc5392d50c4796b0c5eedf38e295382f71570f2066d9e978ed6e3962084b902989863fe1273a8642d8fdb094a266d69de10622a4176b0
2018-11-13 21:34:23 +01:00
Kaz Wesley 6bed4b374d fix a deserialization overflow edge case
A specially-constructed BlockTransactionsRequest can overflow in
deserialization in a way that is currently harmless.
2018-11-13 12:14:34 -08:00
Kaz Wesley 051faf7e9d add a test demonstrating an overflow in a deserialization edge case
Also add a test that the highest legal index is accepted.
2018-11-13 12:14:08 -08:00
Jon Layton fa0815c300
rpc: Correctly name arguments 2018-11-13 14:24:40 -05:00
Ben Woosley bd3b0361d8
Add stop_block out arg to ScanForWalletTransactions
Accurately reports the last block successfully scanned, replacing a return of
the chain tip, which represented possibly inaccurated data in a race condition.
2018-11-13 12:51:16 -05:00
MarcoFalke c651265c93
Merge #14530: Use RPCHelpMan to generate RPC doc strings
fa483e13b3 rpc: Add RPCHelpMan for machine-generated help (MarcoFalke)
fa0d36f712 rpc: Include rpc/util.h where needed for RPCHelpMan (MarcoFalke)

Pull request description:

  This introduces a manager for the RPC help generation and demonstrates its use of it in some RPCs.

  It is the first non-exhaustive step toward #14378 and I will create pull requests for the next steps after this one is merged.

Tree-SHA512: 86f68322443ff01cd964aaf0ebe186be63fbebe4c47676cf7a622cc2b5305fd176bd57badfd1bbf788a036812253eb0dead74ecc3b30664c3e0d9392b2248054
2018-11-13 12:34:50 -05:00
Gregory Sanders b81a186056 GetPubKey: make sigdata const 2018-11-13 10:42:10 -05:00
Wladimir J. van der Laan c51e1516a9
Merge #14714: util.h: explicitly include required QString header
27154ce765 util.h: explicitly include required QString header (1Il1)

Pull request description:

  Alternative to #14713.

  Instead of depending on clang formatter to not reorder includes, another fix is to explicitly include the missing header file.

Tree-SHA512: f419ef2fd1dfd8da28160a94d187af78463fb398ef6aadd6c68ebf57e6d02380d93f5f370bf2d39e88dcbfeb252c3e5f245c0a157c7d0a64c38fc0f0c7004515
2018-11-13 14:52:03 +01:00
Wladimir J. van der Laan ce7fcc3569
Merge #14690: Throw error if CPubKey is invalid during PSBT keypath serialization
4e4de10f69 Throw error if CPubKey is invalid during PSBT keypath serialization (Gregory Sanders)

Pull request description:

  Related to https://github.com/bitcoin/bitcoin/pull/14689

  We should catch this error before attempting to deserialize it later.

Tree-SHA512: d2f3ea7f363818ac70c81ee988231b2bb50d055b6919f7bff3f27120c85a7048bfa183efae33e23e6b81d684bcb8bb81e5b209abb3acbcaff1d88014f4f1aa93
2018-11-13 13:44:09 +01:00
Jonas Schnelli 083f535470
Merge #14608: qt: Remove the "Pay only required fee..." checkbox
a16f44c04 qt: Remove "Pay only required fee" checkbox (Hennadii Stepanov)
8711cc0c7 qt: Improve BitcoinAmountField class (Hennadii Stepanov)

Pull request description:

  Ref #13280
  This PR removes the "Pay only the required fee..." checkbox from the custom transaction fee section in the "Send" tab. Instead, a minimum value will be enforced on the custom fee input box.

  All comments from #13280 are addressed.

  Before:
  ![screenshot from 2018-10-30 16-42-18](https://user-images.githubusercontent.com/32963518/47726622-866d8e80-dc63-11e8-8670-3f97ff0fa5da.png)

  After:
  ![screenshot from 2018-10-30 16-40-37](https://user-images.githubusercontent.com/32963518/47726633-8f5e6000-dc63-11e8-82cf-5b9ff4aae91d.png)

  cc: @promag @MarcoFalke @Sjors

Tree-SHA512: 073577d38d8353b10e8f36fb52e3c6e81dd45d25d84df9b9e4f78f452ff0bdbff3e225bdd6122b5a03839ffdcc2a2a08175f81c2541cf2d12918536abbfa3fd1
2018-11-13 15:44:11 +07:00
Jonas Schnelli b60f4e3f09
Merge #13381: RPC: creates possibility to preserve labels on importprivkey
a6b5ec18f rpc: creates possibility to preserve labels on importprivkey (marcoagner)

Pull request description:

  Closes #13087.

  As discussed in the issue, this is a feature request instead of a bug report since the behaviour was as intended (i.e. label with default: `''`). With this, the old behaviour is kept while the possibility to achieve the preservation of labels, as expected in the open issue, is added.

Tree-SHA512: b33be50e1e7f62f7ddfae953177ba0926e2d848961f9fac7501c2b513322c0cb95787745d07d137488267bad1104ecfdbe800c6747f94162eb07c976835c1386
2018-11-13 14:52:01 +07:00
1Il1 27154ce765
util.h: explicitly include required QString header 2018-11-13 16:49:34 +09:00
Ben Woosley 3002d6cf31
Return a status enum from ScanForWalletTransactions
Return the failed block as an out var.

This clarifies the outcome as the prior return value could
be null due to user abort or failure.
2018-11-13 00:04:13 -05:00
Ben Woosley bb24d68650
Make CWallet::ScanForWalletTransactions args and return value const 2018-11-13 00:01:14 -05:00
Ben Woosley 1a9f9f7e5e
Introduce SafeDbt to handle DB_DBT_MALLOC raii-style
This provides additional exception-safety and case handling for the proper
freeing of the associated buffers.
2018-11-12 18:43:52 -05:00
Gregory Sanders f7beb95a1f remove redundant KeyOriginInfo access, already done in CreateSig 2018-11-12 13:17:49 -05:00
Wladimir J. van der Laan 47ed24cf8a
Merge #14356: fix converttopsbt permitsigdata arg, add basic test
88a79cb436 fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders)

Pull request description:

  The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

  Resolves https://github.com/bitcoin/bitcoin/issues/14355

Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
2018-11-12 19:14:13 +01:00
Gregory Sanders 0fb2e69815 CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change 2018-11-12 13:12:09 -05:00
Gregory Sanders b06483c96a Remove stale comment in CalculateMaximumSignedInputSize 2018-11-12 13:10:54 -05:00
MarcoFalke fa483e13b3
rpc: Add RPCHelpMan for machine-generated help 2018-11-12 11:11:17 -05:00
Wladimir J. van der Laan 90c0b6aca2
Merge #14494: Error if # is used in rpcpassword in conf
0385109444 Add test for rpcpassword hash error (MeshCollider)
13fe258e91 Error if rpcpassword in conf contains a hash character (MeshCollider)

Pull request description:

  Fixes #13143 now #13482 was merged

Tree-SHA512: e7d00c8df1657f6b8d0eee1e06b9ce2b1b0a2de487377699382c1b057836e1571dac313ca878b5877c862f0461ba789a50b239d2a9f34accd8a6321f126e3d2a
2018-11-12 15:23:27 +01:00
Wladimir J. van der Laan 5cdfd72b17
Merge #14228: Qt: Enable system tray icon by default if available
ec1201a368 Don't use systray icon on inappropriate systems (Hennadii Stepanov)

Pull request description:

  Prevent a user from losing access to the main window by minimizing it to the tray on the systems which have not “system tray” or “notification area” available (e.g. GNOME 3.26+).

  Tested on Fedora 28 + GNOME 3.28.

Tree-SHA512: c2dc26ff31c38a882dbd7d1ff71af99f1ba38a04a1c8b7fe7b99b93e4c0719f2916c7db0e620806a36582402d18939c635e1913c276b452ecbf939936067407b
2018-11-12 15:08:06 +01:00
Wladimir J. van der Laan 48223256cf
Merge #14123: gui: Add GUIUtil::bringToFront
0a656f85a9 qt: All tray menu actions call showNormalIfMinimized (João Barbosa)
6fc21aca6d qt: Use GUIUtil::bringToFront where possible (João Barbosa)
5796671e1d qt: Add GUIUtil::bringToFront (João Barbosa)
6b1d2972bf Remove obj_c for macOS Dock icon menu (Hennadii Stepanov)
2464925e7b Use Qt signal for macOS Dock icon click event (Hennadii Stepanov)
53bb6be3f8 Remove obj_c for macOS Dock icon setting (Hennadii Stepanov)

Pull request description:

  The sequence `show -> raise -> activateWindow` is factored out to the new function `GUIUtil::bringToFront` where a macOS fix is added in order to fix #13829.

  Also included:
   - simplification of `BitcoinGUI::showNormalIfMinimized`
   - simplified some connections to `BitcoinGUI::showNormalIfMinimized`
   - added missing connections to `BitcoinGUI::showNormalIfMinimized`.

Tree-SHA512: a8e301aebc359aa353821e2af352ae356f44555724921b01da907e128653ef9dc55d8764a1bff72a579e5ff96df8a681f6804bfe83acba441da92fedff974a55
2018-11-12 14:52:35 +01:00
Wladimir J. van der Laan ae32806ea2
Merge #14651: Refactor: Fix compiler warning in prevector.h
76e13b586f warnings: Compiler warning on memset usage for non-trivial type (Lenny Maiorani)

Pull request description:

  Fixing warnings reported by GCC: memset of non-trivial type

Tree-SHA512: 357aeac60acfb922851daaf0bd8d4b81e377da7c9b31c2942b54cfdd4129dae61e577fc0a6aa430348cb07abd16ae32f986a64dbb2c1d90ec148f53e7451a229
2018-11-12 13:43:56 +01:00
Wladimir J. van der Laan edc715240c
Merge #12783: macOS: disable AppNap during sync
1e0f3c4499 macOS: disable AppNap during sync (Alexey Ivanov)

Pull request description:

  Code based on pull/5804. Tested only on macOS 10.13.3 and should support 10.9+.

  What macOS versions bitcoin core currently supports?

Tree-SHA512: 85809b8d8d8a05169437b4268988da0b7372c29c6da3223ebdc106dc16dcb6d3caa5c52ace3591467005b50a63fd8b2ab1cb071cb4f450032932df25d5063315
2018-11-10 10:37:59 +01:00
Pieter Wuille 16e3b17578
Merge #14689: Require a public key to be retrieved when signing a P2PKH input
6b8d86ddb8 Require a public key to be retrieved when signing a P2PKH input (Andrew Chow)

Pull request description:

  If we do not have the public key for a P2PKH input, we should not continue to attempt to sign for it.

  This fixes a problem where a PSBT with a P2PKH output would include invalid BIP 32 derivation paths that are missing the public key.

Tree-SHA512: 850d5e74c06833da937d5bf0348bd134180be7167b6f9b9cecbf09f75e3543fbad60d0abbc0b9afdfa51ce165aa36168849f24a7c5abf1e75f37ce8f9a13d127
2018-11-09 20:14:28 -08:00
Pieter Wuille b30c62d4b9
Merge #14588: Refactor PSBT signing logic to enforce invariant and fix signing bug
e13fea975d Add regression test for PSBT signing bug #14473 (Glenn Willen)
565500508a Refactor PSBTInput signing to enforce invariant (Glenn Willen)
0f5bda2bd9 Simplify arguments to SignPSBTInput (Glenn Willen)
53e6fffb8f Add bool PSBTInputSigned (Glenn Willen)
65166d4cf8 New PartiallySignedTransaction constructor from CTransction (Glenn Willen)
4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT (Glenn Willen)
fe5d22bc67 More concise conversion of CDataStream to string (Glenn Willen)

Pull request description:

  As discussed in the comments on #14473, I think that bug was caused primarily by failure to adhere to the invariant that a PSBTInput always has exactly one of the two utxo fields present -- an invariant that is already enforced by PSBTInput::IsSane, but which we were temporarily suspending during signing.

  This refactor repairs the invariant, also fixing the bug. It also simplifies some other code, and removes redundant parameters from some related functions.

  fixes #14473

Tree-SHA512: cbad3428175e30f9b7bac3f600668dd1a8f9acde16b915d27a940a2fa6d5149d4fbe236d5808fd590fb20a032274c99e8cac34bef17f79a53fdf69a5948c0fd0
2018-11-09 19:43:09 -08:00
MeshCollider b4f6e58ca5 Better error message for user when corrupt wallet unlock fails 2018-11-10 15:07:20 +13:00
MarcoFalke fa0d36f712
rpc: Include rpc/util.h where needed for RPCHelpMan
Just a preparatory commit to add the header to the includes and run
clang-format to sort the include lists.

Splitting this up into a separate commit makes future scripted-diffs
easier.
2018-11-09 12:37:06 -05:00
MarcoFalke cbf00939b5
Merge #14437: Refactor: Start to separate wallet from node
081accb875 Pass chain locked variables where needed (Russell Yanofsky)
79d579f4e1 Remove uses of cs_main in wallet code (Russell Yanofsky)
ea961c3d72 Remove direct node->wallet calls in init.cpp (Russell Yanofsky)
8db11dd0b1 Pass chain and client variables where needed (Russell Yanofsky)
7e2e62cf7c Add skeleton chain and client classes (Russell Yanofsky)

Pull request description:

  This creates an incomplete [`Chain`](https://github.com/ryanofsky/bitcoin/blob/pr/wipc-sep/src/interfaces/chain.h) interface in [`src/interfaces/`](https://github.com/ryanofsky/bitcoin/tree/pr/wipc-sep/src/interfaces) and begins to update wallet code to use it.

  #10973 builds on this, changing the wallet to use the new interface to access chain state, instead of using CBlockIndex pointers and global variables like `chainActive`.

Tree-SHA512: 6ef05a4d8ebf57f2ad71835e4d970c9c59e34057e39e48cee76b887492c2fee907e3f6a74a9861e5a9f97cdc6823f4865ebc41ec556ab371ebca1b664c20dbea
2018-11-09 10:02:22 -05:00
MarcoFalke e70a19e713
Merge #14684: [doc] conf: Remove deprecated options from docs, Other cleanup
fa4da3c058 [doc] conf: Remove deprecated options from docs, Other cleanup (MarcoFalke)

Pull request description:

  Some dumb fixes, like removing the mention that free transactions are still a thing or that rpcuser/pass should be used (as opposed to rpcauth or rpc cookie).

  Combined with other fixes because I don't want to create 3 pull requests:
  * conf: Remove deprecated options from docs
  * Remove only mention of MIT/X11
  * Link to developer notes in README.md

Tree-SHA512: 9e45dc6c63037e7618cf3c871d7d9e65b66f1a952f91a6e623d97d90171e29bc40299a06029c4dc21a0f579e68021e3663186bd3a65e3ab333aff711f7dcb2bf
2018-11-08 12:56:40 -05:00
Gregory Sanders 4e4de10f69 Throw error if CPubKey is invalid during PSBT keypath serialization 2018-11-08 10:51:20 -05:00
Andrew Chow 6b8d86ddb8 Require a public key to be retrieved when signing a P2PKH input
If we do not have the public key for a P2PKH input, we should not
continue to attempt to sign for it.
2018-11-08 10:38:43 -05:00
Chun Kuan Lee 591203149f wallet: Create IsDatabaseLoaded function 2018-11-08 11:54:37 +08:00
Chun Kuan Lee 7a90b1b9d8 build: Fix windows build error if --disable-bip70 2018-11-08 05:03:14 +08:00
MarcoFalke 11e1ac3ae0
Merge #14436: doc: add comment explaining recentRejects-DoS behavior
b191c7dfb7 doc: add comment explaining recentRejects-DoS behavior (James O'Beirne)

Pull request description:

  When we receive invalid txs for the first time, we mark the sender as
  misbehaving. If we receive the same tx before a new block is seen, we *don't*
  punish the second sender (in the same way we do the original sender). It wasn't
  initially clear to me that this is intentional, so add a clarifying comment.

Tree-SHA512: d12c674db137ed3ad83e0b941bffe6ddcd2982238048742afa574a4235881f0e58cfc0a4a576a0503e74c5c5240c270b9520fa30221e8b43a371fb3e0b37066b
2018-11-07 14:59:35 -05:00
Gregory Sanders 7afddfa8ce importmulti: Don't add internal addresses to address book 2018-11-07 14:43:14 -05:00
MarcoFalke fa4da3c058
[doc] conf: Remove deprecated options from docs, Other cleanup
* conf: Remove deprecated options from docs
* Remove only mention of MIT/X11
* Link to developer notes in README.md
2018-11-07 13:30:03 -05:00
MarcoFalke e8d490f27e
Merge #14636: Avoid using numeric_limits for sequence numbers and lock times
535203075e Avoid using numeric_limits for sequence numbers and lock times (Russell Yanofsky)
bafb921507 Remove duplicated code (Hennadii Stepanov)
e4dc39b3bc Replace platform dependent type with proper const (Hennadii Stepanov)

Pull request description:

  Switches to named constants, because numeric_limits calls can be harder to read and less portable.

  Change was suggested by jamesob in https://github.com/bitcoin/bitcoin/pull/10973#discussion_r213473620

  There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where `SignalsOptInRBF` and `MutateTxAddInput` functions would now work correctly.

Tree-SHA512: 3f5c6393c260551f65a0edfba55ef7eb3625232eec8d85b1457f26e144aa0b90c7ef5f44b2fd2f7d9be3c3bcb301030a9f5473c21b3bac566cc59b8c8780737c
2018-11-07 11:15:22 -05:00
Jim Posen c30620983d blockfilter: Additional constructors for BlockFilter. 2018-11-06 09:12:54 -08:00
Jim Posen 20b812993a blockfilter: Refactor GCS params into struct. 2018-11-06 09:12:54 -08:00
practicalswift 587924f000 Use IsSpace(...) instead of boost::is_space 2018-11-06 17:32:13 +01:00
practicalswift c5fd143edb Use ToLower(...) instead of std::tolower 2018-11-06 17:32:13 +01:00
practicalswift e70cc8983c Use IsDigit(...) instead of std::isdigit 2018-11-06 17:32:08 +01:00
Russell Yanofsky 081accb875 Pass chain locked variables where needed
This commit does not change behavior. All it does is pass new function
parameters.

It is easiest to review this change with:

    git log -p -n1 -U0 --word-diff-regex=.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 79d579f4e1 Remove uses of cs_main in wallet code
This commit does not change behavior.

It is easiest to review this change with:

    git log -p -n1 -U0
2018-11-06 11:44:40 -04:00
Russell Yanofsky ea961c3d72 Remove direct node->wallet calls in init.cpp
Route calls during node initialization and shutdown that would happen between a
node process and wallet processes through the serializable `Chain::Client`
interface, rather than `WalletInitInterface` which is now simpler and only
deals with early initialization and parameter interaction.

This commit mostly does not change behavior. The only change is that the
"Wallet disabled!" and "No wallet support compiled in!" messages are now logged
earlier during startup.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 8db11dd0b1 Pass chain and client variables where needed
This commit does not change behavior. All it does is pass new function
parameters.

It is easiest to review this change with:

    git log -p -n1 -U0 --word-diff-regex=.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 7e2e62cf7c Add skeleton chain and client classes
This commit does not change behavior. It just adds new skeleton classes that
don't do anything and aren't instantiated yet.
2018-11-06 11:44:40 -04:00
Wladimir J. van der Laan 880bc728b4
Merge #14074: Use std::unordered_set instead of set in blockfilter interface
fef5adcc33 blockfilter: Use unordered_set instead of set in blockfilter. (Jim Posen)
4fb789e9b2 Extract CSipHasher to it's own file in crypto/ directory. (Jim Posen)

Pull request description:

  Use `std::unordered_set` (hash set) instead of `std::set` (tree set) in blockfilter interface, as suggested by @ryanofsky in #12254. This may result in a very minor speedup, but I haven't measured.

  This moves `CSipHasher` to it's own file `crypto/siphash.h`, so that it can be used in the libbitcoin_util library without including `hash.{h,cpp}`. I'm open to other suggestions on solving this issue if people would prefer to leave CSipHasher where it is.

Tree-SHA512: 593d1abda771e45f2860d5334272980d20df0b81925a402bb9ee875e17595c2517c0d8ac9c579218b84bbf66e15b49418241c1fe9f9265719bcd2377b0cd0d88
2018-11-06 15:36:20 +01:00
Chun Kuan Lee 15c93f075a wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. 2018-11-06 08:28:02 +08:00
Russell Yanofsky c456fbd8df Refactor: Move m_db pointers into BerkeleyDatabase
This is a refactoring change that doesn't affect behavior. The motivation
behind the change is give BerkeleyEnvironment objects access to
BerkeleyDatabase objects so it will be possible to simplify the duplicate
wallet check and more reliably avoid opening the same databases twice.
2018-11-06 08:28:02 +08:00
MeshCollider 13fe258e91 Error if rpcpassword in conf contains a hash character 2018-11-06 12:35:07 +13:00
Jim Posen fef5adcc33 blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
Jim Posen 4fb789e9b2 Extract CSipHasher to it's own file in crypto/ directory.
This is a move-only commit with the exception of changes to includes.
2018-11-05 09:25:15 -08:00
practicalswift 9cc0230cfc Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. 2018-11-05 17:03:11 +01:00
practicalswift 579497e77a tests: Explicitly ignore the return value of DecodeBase58(...) 2018-11-05 16:52:59 +01:00
practicalswift 145fe95ec7 tests: Check return value of ParseParameters(...) 2018-11-05 16:52:59 +01:00
practicalswift 7c5bc2a523 miner: Default to DEFAULT_BLOCK_MIN_TX_FEE if unable to parse -blockmintxfee 2018-11-05 16:52:59 +01:00
ken2812221 b6022149ec
trivial: Don't translate in help text 2018-11-05 23:23:28 +08:00
MarcoFalke 73a8408bc3
Merge #14092: tests: Dry run bench_bitcoin as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code
dfef0df840 tests: Dry run bench_bitcoin (-evals=1 -scaling=0: <1 second running time) as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code (practicalswift)
00c6306a61 Remove RUN_BENCH logic (practicalswift)

Pull request description:

  Dry run `bench_bitcoin` (`-evals=1 -scaling=0`: <1 second running time) as part `make check` to allow for quick identification of assertion/sanitizer failures or crashes in benchmarking code.

  This is already tested in Travis but it is nice to have it locally too. The cost is near zero.

Tree-SHA512: 1f51b86b34bf97f75785f2694891d80f1bfb3e050211e6f6c35d8d9bc80c75bdebaa5ebfa51855ac0cf76d8773c3026bc576f60d0227afb0e646d728b83abde7
2018-11-05 09:31:01 -05:00
Wladimir J. van der Laan dac2caa371
Merge #14060: ZMQ: add options to configure outbound message high water mark, aka SNDHWM
a4edb168b6 ZMQ: add options to configure outbound message high water mark, aka SNDHWM (mruddy)

Pull request description:

  ZMQ: add options to configure outbound message high water mark, aka SNDHWM

  This is my attempt at https://github.com/bitcoin/bitcoin/pull/13315

Tree-SHA512: a4cc3bcf179776899261a97c8c4f31f35d1d8950fd71a09a79c5c064879b38e600b26824c89c4091d941502ed5b0255390882f7d44baf9e6dc49d685a86e8edb
2018-11-05 13:45:41 +01:00
practicalswift ab8c6f24d2 Add SAFE_CHARS[SAFE_CHARS_URI]: Chars allowed in URIs (RFC 3986) 2018-11-05 13:27:04 +01:00
practicalswift 991248649b rpc: Make HTTP RPC debug logging more informative 2018-11-05 13:27:02 +01:00
Wladimir J. van der Laan 15a219ff8e
Merge #14628: Trivial: Rename misleading 'defaultPort' to 'rpc_port'
4ed730802f scripted-diff: Rename misleading 'defaultPort' to 'http_port' (Murray Nesbitt)

Pull request description:

  `defaultPort` in `HTTPBindAddresses()` is misleadingly named. `defaultPort ` suggests a constant, not something that might be overridden by `-rpcport`.

Tree-SHA512: f6ae8bdc2b4a4f503e44df9efdec32c854d2dede87714399f53791d50cce6bc41c46b01d1583cfc0e3e4777c244e1c74443fa39d9da50a45e53af265b74a17d1
2018-11-05 13:18:35 +01:00
Wladimir J. van der Laan 46eb2755d4
Merge #14350: Add WalletLocation class
65f3672f3b wallet: Refactor to use WalletLocation (João Barbosa)
01a4c095c8 wallet: Add WalletLocation utility class (João Barbosa)

Pull request description:

  Advantages of this change:
   - avoid resolving wallet absolute path and name repetitively and in multiple places;
   - avoid calling `GetWalletDir` in multiple places;
   - extract these details from the actual wallet implementation.

  The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory.

Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
2018-11-05 13:17:03 +01:00
Murray Nesbitt 4ed730802f scripted-diff: Rename misleading 'defaultPort' to 'http_port'
-BEGIN VERIFY SCRIPT-
sed -i -e 's/\<defaultPort\>/http_port/g' src/httpserver.cpp
-END VERIFY SCRIPT-
2018-11-05 04:01:47 -08:00
Wladimir J. van der Laan 69d574ac6c
Merge #14554: qt: Remove unused adjustedTime parameter
04972fefd1 Remove unused `adjustedTime` parameter (Hennadii Stepanov)

Pull request description:

  After merging #13622 the `adjustedTime` parameter in the `updateStatus` function is unused.

Tree-SHA512: 1d0e03e7343f076ee0032fb721f8ba50571d579958001aab372a43e45b4de24c2bf3bd18c245071cbd69f61ef38182e19666c6f936d55c9085b73c848ba62626
2018-11-05 12:50:11 +01:00
Hennadii Stepanov 60ae463a68
Fix bitcoin-qt -version output formatting 2018-11-05 13:37:48 +02:00
Hennadii Stepanov c3f1821ac7
Make blockdir always net specific
The blocks directory is net specific by definition.

Also this prevents the side effect of calling GetBlocksDir(false) in the
non-mainnet environment.
2018-11-05 13:26:43 +02:00
João Barbosa 0a656f85a9 qt: All tray menu actions call showNormalIfMinimized 2018-11-05 11:21:50 +00:00
João Barbosa 6fc21aca6d qt: Use GUIUtil::bringToFront where possible 2018-11-05 11:21:50 +00:00
João Barbosa 5796671e1d qt: Add GUIUtil::bringToFront 2018-11-05 11:21:50 +00:00
Wladimir J. van der Laan bccb4d29a8
Merge #14555: Move util files to directory
2068f089c8 scripted-diff: Move util files to separate directory. (Jim Posen)

Pull request description:

  As discussed [here](https://github.com/bitcoin/bitcoin/pull/14074#issuecomment-429090584), this establishes a `util/` directory to introduce more organizational structure and have a clear place for new util files. It's really not scary to review, it's just one big scripted diff.

Tree-SHA512: 39cf15480d7d35e987b6088d52a857a2d5b1802e36c6b815eb42718d80cd95e669757af9bcc7c04426cd8523662cb1050b8da1e2377d3730672820ed298b894b
2018-11-05 11:34:29 +01:00
Jim Posen 2068f089c8 scripted-diff: Move util files to separate directory.
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmemory.h src/util/memory.h
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp

sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
-END VERIFY SCRIPT-
2018-11-04 22:46:07 -08:00
Lenny Maiorani 76e13b586f warnings: Compiler warning on memset usage for non-trivial type
Problem:
- IS_TRIVIALLY_CONSTRUCTIBLE macro does not work correctly resulting
  in `memset()` usage to set a non-trivial type to 0 when
  `nontrivial_t` is passed in from the tests.
- Warning reported by GCC when compiling with `--enable-werror`.

Solution:
- Use the standard algorithm `std::fill_n()` and let the compiler
  determine the optimal way of looping or using `memset()`.
2018-11-04 20:50:40 -07:00
MarcoFalke b74078868b
Merge #14410: rpcwallet: 'ischange' field for 'getaddressinfo' RPC
14a06525b2 tests: add test for 'getaddressinfo' RPC result 'ischange' field (whythat)
93d1aa9abc rpcwallet: add 'ischange' field to 'getaddressinfo' response (whythat)

Pull request description:

  Implementation of proposal in #14396.

  This introduces `CWallet::IsChange(CScript&)` method and replaces original `CWallet::IsChange(CTxOut&)` method with overloaded version that delegates to the new method with *txout*'s `scriptPubKey`. In this way `TODO` note from the original method can still be addressed in a single place.

Tree-SHA512: ef5dbc82d76b4b9b2fa6a70abc3385a677c55021f79e187ee2f392ee32bc6b406191f4129acae5c17b0206e72b6712e7e0cad574a4bbd966871c2e656c45e041
2018-11-04 17:23:11 -05:00
Hennadii Stepanov 6b1d2972bf
Remove obj_c for macOS Dock icon menu
Qt `setAsDockMenu()` does this work.
2018-11-04 02:42:18 +02:00
Hennadii Stepanov 2464925e7b
Use Qt signal for macOS Dock icon click event
This moves the Dock icon click reaction code to the common place and
allows some cleanup in obj_c code.

According to the Apple's docs `class_replaceMethod` behaves as
`class_addMethod`, if the method identified by name does not yet exist;
or as `method_setImplementation`, if it does exist.
2018-11-04 02:37:28 +02:00
Glenn Willen 565500508a Refactor PSBTInput signing to enforce invariant
Refactor the process of PSBTInput signing to enforce the invariant that
a PSBTInput always has _either_ a witness_utxo or a non_witness_utxo,
never both.

This simplifies the logic of SignPSBTInput slightly, since it no longer
has to deal with the "both" case. When calling it, we now give it, in
order of preference: (1) whichever of the utxo fields was already
present in the PSBT we received, or (2) if neither, the
non_witness_utxo field, which is just a copy of the input transaction,
which we get from the wallet.

SignPSBTInput no longer has to remove one of the two fields; instead, it
will check if we have a witness signature, and if so, it will replace
the non_witness_utxo with the witness_utxo (which is smaller, as it is
just a copy of the output being spent.)

Add PSBTInput::IsSane checks in two more places, which checks for
both utxo fields being present; we will now give an RPC error early on
if we are supplied such a malformed PSBT to fill in.

Also add a check to FillPSBT, to avoid touching any input that is
already signed. (This is now redundant, since we should no longer
potentially harm an already-signed input, but it's harmless.)

fixes #14473
2018-11-01 12:14:21 -07:00
Glenn Willen 0f5bda2bd9 Simplify arguments to SignPSBTInput
Remove redundant arguments to SignPSBTInput -- since it needs several
bits of the PartiallySignedTransaction, pass in a reference instead of
doing it piecemeal. This saves us having to pass in both a PSBTInput and
its index, as well as having to pass in the CTransaction. Also avoid
redundantly passing the sighash_type, which is contained in the
PSBTInput already.
2018-11-01 12:11:24 -07:00
Glenn Willen 53e6fffb8f Add bool PSBTInputSigned
Refactor out a "PSBTInputSigned" function to check if a PSBT is signed,
for use in subsequent commits.

Also improve a related comment.
2018-11-01 12:11:24 -07:00
Glenn Willen 65166d4cf8 New PartiallySignedTransaction constructor from CTransction
New constructor that creates a PartiallySignedTransaction from a
CTransaction, automatically sizing the inputs and outputs vectors for
convenience.
2018-11-01 12:11:24 -07:00
Glenn Willen 4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT 2018-11-01 12:11:24 -07:00
Glenn Willen fe5d22bc67 More concise conversion of CDataStream to string
Use .str() instead of .data() and .size() when converting CDataStream to
a string. Uses std::string, avoiding conversion to a C string.
2018-11-01 12:11:24 -07:00
Russell Yanofsky 535203075e Avoid using numeric_limits for sequence numbers and lock times
Switches to named constants, because numeric_limits calls can be harder to read
and less portable.

Change was suggested by James O'Beirne <james.obeirne@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/10973#discussion_r213473620

There are no changes in behavior except on some platforms we don't support
(ILP64, IP16L32, I16LP32), where SignalsOptInRBF() and MutateTxAddInput()
functions would now work correctly.
2018-11-01 12:55:39 -04:00
Wladimir J. van der Laan 51e5ef3971
Merge #14377: check that a separator is found for psbt inputs, outputs, and global map
4fb3388db9 check that a separator is found for psbt inputs, outputs, and global map (Andrew Chow)

Pull request description:

  Currently it doesn't make sure that a separator was found so PSBTs missing a trailing separator would still pass. This fixes that and adds a test case for it.

  It really only makes sense to check for the separator for the output maps as if an input or global map was missing a separator, the fields following it would be interpreted as belonging to the previous input or global map. However I have added the check for those two anyways to be consistent.

Tree-SHA512: 50c0c08e201ba02494b369a4d36ddb73e6634eb5a4e4e201c4ef38fd2dbeea2c642b8a04d50c91615da61ecbfade37309e47431368f4b1064539c42015766b50
2018-11-01 17:55:39 +01:00
Hennadii Stepanov bafb921507 Remove duplicated code
The deleted LOC is a dup so far as
`std::numeric_limits<unsigned int>::min()` == 0
2018-11-01 19:55:39 +03:00
Hennadii Stepanov e4dc39b3bc Replace platform dependent type with proper const 2018-11-01 19:55:39 +03:00
Alexey Ivanov 1e0f3c4499
macOS: disable AppNap during sync
Signed-off-by: Alexey Ivanov <alexey.ivanes@gmail.com>
2018-11-01 18:22:06 +03:00
Wladimir J. van der Laan f6df989842
Merge #14197: [psbt] Convert non-witness UTXOs to witness if witness sig created
862d159d63 Add test for conversion from non-witness to witness UTXO (Pieter Wuille)
f8c1714634 Convert non-witness UTXOs to witness if witness sig created (Andrew Chow)

Pull request description:

  If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.

  Port of #14196 to master.

Tree-SHA512: 2235eeb008ffa48e821628032d689e4a83bff6c29b93fa050ab2ee492b0e67b3a30f29a680d4a0e574e05c3a2f9edf0005e161fbe25b7aef2acd034a2424e2f2
2018-11-01 16:09:38 +01:00
Hennadii Stepanov 53bb6be3f8
Remove obj_c for macOS Dock icon setting
Qt `setWindowIcon()` does this work.
2018-10-31 20:29:08 +02:00
Wladimir J. van der Laan b312579c69
Merge #14454: Add SegWit support to importmulti
c11875c590 Add segwit address tests for importmulti (MeshCollider)
201451b1ca Make getaddressinfo return solvability (MeshCollider)
1753d217ea Add release notes for importmulti segwit change (MeshCollider)
353c064596 Fix typo in test_framework/blocktools (MeshCollider)
f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup (MeshCollider)

Pull request description:

  Add support for segwit to importmulti, supports P2WSH, P2WPKH, P2SH-P2WPKH, P2SH-P2WSH. Adds a new `witnessscript` parameter which must be used for the witness scripts in the relevant situations.

  Also includes some tests for the various import types.

  ~Also makes the change in #14019 redundant, but cherry-picks the test from that PR to test the behavior (@achow101).~

  Fixes #12253, also addresses the second point in #12703, and fixes #14407

Tree-SHA512: 775a755c524d1c387a99acddd772f677d2073876b72403dcfb92c59f9b405ae13ceedcf4dbd2ee1d7a8db91c494f67ca137161032ee3a2071282eeb411be090a
2018-10-31 17:44:31 +01:00
Hennadii Stepanov a16f44c040
qt: Remove "Pay only required fee" checkbox
The custom fee input box now has a minimum value equal to the minimum
required fee. Before a value below the minimum fee could be entered
which was confusing since the minimum fee would still be paid even
though a lower amount was entered.
2018-10-30 16:31:57 +02:00
Hennadii Stepanov 8711cc0c78
qt: Improve BitcoinAmountField class
This adds functions for specifing a min/max value for a
BitcoinAmountField. These options only affect user input, so it's still
possible to use setValue to set values outside of the min/max range. The
existing value will not be changed when calling these functions even if
it's out of range. The min/max range will be reinforced when the field
loses focus.
This also adds `SetAllowEmpty` function which specifies if the field is
allowed to be left empty by the user. If set to false the field will be
set to the minimum allowed value if it's empty when focus is lost.
2018-10-30 14:58:25 +02:00
Luke Dashjr d8bf1071cf Bugfix: RPC: Add address_type named param for createmultisig 2018-10-28 22:42:36 +00:00
MarcoFalke f1e2f2a859
Merge #14585: refactor: remove usage of locale dependent std::isspace
15db77f4dd Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...) (practicalswift)

Pull request description:

  Don't rely on locale dependent function `std::isspace` in `base_blob<BITS>::SetHex(...)` (uint256), `DecodeBase58(...)`, `ParseMoney(...)` and `ParseHex(...)`.

  Rationale:

  ```
  $ uname -s
  Darwin
  $ cat poc.cpp
  #include <iostream>
  #include <locale>

  int main(void) {
      setlocale(LC_ALL, "");
      std::cout << std::isspace(133) << ' ' << std::isspace(154) << ' ' << std::isspace(160);
      std::cout << '\n';
  }
  $ clang++ -o poc poc.cpp
  $ ./poc
  1 0 1
  $ LC_ALL=en_US ./poc
  1 0 1
  $ LC_ALL=C ./poc
  0 0 0
  $ LC_ALL=ru_RU.KOI8-R ./poc # an "interesting" locale
  0 1 0
  ```

Tree-SHA512: 4eafb267342b8a777da6cca07c353afd1f90f3fc1d91e01f526f1b384a2b97c1da25b7bd7dfc300655182a4eaec6a4bea855a45723ab53c750a734b60e1e3c9f
2018-10-28 06:49:07 -04:00
Hennadii Stepanov 04972fefd1
Remove unused adjustedTime parameter
qt: After merging #13622 the `adjustedTime` is not used any more in
wallet related functions.
2018-10-28 09:04:10 +02:00
MarcoFalke efaf2d85e3
Merge #13783: validation: Pass tx pool reference into CheckSequenceLocks
fa511e8dad Pass tx pool reference into CheckSequenceLocks (MarcoFalke)

Pull request description:

  `CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

  This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes)

Tree-SHA512: f0804588c7d29bb6ff05ec14f22a16422b89ab31ae714f38cd07f811d7dc7907bfd14e799c4c1c3121144ff22711019bbe9212b39e2fd4531936a4119950fa49
2018-10-27 10:39:44 -04:00
practicalswift 15db77f4dd Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...) 2018-10-26 19:42:58 +02:00
Pieter Wuille 9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable 2018-10-26 10:21:05 -07:00
Pieter Wuille 225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others 2018-10-26 10:21:05 -07:00
Pieter Wuille 4d78bd93b5 Add support for inferring descriptors from scripts 2018-10-26 10:21:05 -07:00
MarcoFalke ae85c8d28b
Merge #14568: build: Fix Qt link order for Windows build
fbaccbf00c build: Fix Qt link order for Windows build (Chun Kuan Lee)

Pull request description:

  See https://github.com/bitcoin/bitcoin/pull/14451#issuecomment-432874893

Tree-SHA512: 819e68dc750297a74d04aa1ad3dae64072b66df718d36b950bd9430c9fca1771c611af934df23954f81b83bd89f96ea76c20cbf17db1364b988a6c34c43fb631
2018-10-26 07:46:31 -04:00
Wladimir J. van der Laan d50c996a14
Merge #14561: Remove fs::relative call and fix listwalletdir tests
ed2e18398b Remove fs::relative call and fix listwalletdir tests (João Barbosa)

Pull request description:

  The implementation of `fs::relative` resolves symlinks which is not intended
  in ListWalletDir. The replacement does what is required, and `listwalletdir` RPC
  tests are fixed accordingly.

  Also, `fs::recursive_directory_iterator` iteration is fixed to build with boost 1.47.

  Based on #14559

Tree-SHA512: 1da516226073f195285d10d9d9648c90cce0158c5d1eb9c31217bb4abb575cd37f07c00787c5a850554d6120bbc5a3cbc5cb47d4488b32ac6bcb52bc1882d600
2018-10-26 13:25:35 +02:00
Wladimir J. van der Laan 9d4541508b
Merge #14518: rpc: Always throw in getblockstats if -txindex is required
3be209d103 rpc: Always throw in getblockstats if -txindex is required (João Barbosa)

Pull request description:

  Previously blocks with only the coinbase transaction didn't cause
  the RPC error even if the requested stats required -txindex and
  it wasn't enabled.

  Fixes #14499.

Tree-SHA512: d3a6402889e3ce7199632e79eba66d7d471ff7de5c564d35312e2340cc6d84ef544a8172548fbc2eedf5e637b56dc57bbf7a9815ab798c7f226755f897fd8f3e
2018-10-26 13:21:17 +02:00
João Barbosa ed2e18398b Remove fs::relative call and fix listwalletdir tests
The implementation of fs::relative resolves symlinks which is not intended
in ListWalletDir. The replacement does what is required, and listwalletdir
tests are fixed accordingly.

Also, building with boost 1.47 required 2 changes:
 - replace fs::relative with an alternative implementation;
 - fix fs::recursive_directory_iterator iteration.
2018-10-25 15:33:56 +01:00
Chun Kuan Lee fbaccbf00c build: Fix Qt link order for Windows build 2018-10-25 20:14:48 +08:00
João Barbosa 65f3672f3b wallet: Refactor to use WalletLocation 2018-10-25 12:33:26 +01:00
João Barbosa 01a4c095c8 wallet: Add WalletLocation utility class 2018-10-25 11:53:17 +01:00
MeshCollider 201451b1ca Make getaddressinfo return solvability 2018-10-25 09:30:57 +13:00
MeshCollider f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup 2018-10-25 09:30:56 +13:00
Wladimir J. van der Laan 2b88f67e0b
Merge #14320: [bugfix] wallet: Fix duplicate fileid detection
4ea77320c5 tests: add test case for loading copied wallet twice (Chun Kuan Lee)
2d796faf62 wallet: Fix duplicate fileid (Chun Kuan Lee)

Pull request description:

  The implementation in current master can not detect if the file ID is duplicate with flushed `BerkeleyEnvironment`. This PR would store the file ID in a global variable `g_fileids` and release it when the `BerkeleyDatabase` close. So it won't have to rely on a `Db*`.

  Fix #14304

Tree-SHA512: 0632254b696bb4c671b5e2e5781e9012df54ba3c6ab0f919d9f6d31f374d3b0f8bd968b90b537884ac8c3d2906afdd58c2ce258666263464c7dbd636960b0e8f
2018-10-24 17:37:32 +02:00
Chun Kuan Lee 2d796faf62 wallet: Fix duplicate fileid 2018-10-24 23:08:16 +08:00
Wladimir J. van der Laan a74ed3a05b
Merge #14453: rpc: Fix wallet unload during walletpassphrase timeout
8907df9e02 qa: Ensure wallet unload during walletpassphrase timeout (João Barbosa)
321decffa1 rpc: Fix wallet unload during walletpassphrase timeout (João Barbosa)

Pull request description:

  Replaces the raw wallet pointer in the `RPCRunLater` callback with a `std::weak_ptr` to check if the wallet is not expired.

  To test:
  ```
  bitcoind -regtest
  bitcoin-cli -regtest encryptwallet foobar
  bitcoin-cli -regtest walletpassphrase foobar 5 && bitcoin-cli -regtest unloadwallet ""
  ```

  Fixes #14452.

Tree-SHA512: 311e839234f5fb7955ab5412a2cfc1903ee7132ea56a8ab992ede3614586834886bd65192b76531ae0aa3a526b38e70ca2e1cdbabe52995906ff97b49d93c268
2018-10-24 16:44:43 +02:00
Wladimir J. van der Laan 9886590116
Merge #14451: Add BIP70 deprecation warning and allow building GUI without BIP70 support
48439b3c10 Don't link SSL_LIBS with GUI unless BIP70 is enabled (James Hilliard)
fbb643d2a5 Add BIP70 deprecation warning (James Hilliard)
38b98507cd qt: cleanup: Move BIP70 functions together in paymentserver (Wladimir J. van der Laan)
9dcf6c0dfe build: Add --disable-bip70 configure option (Wladimir J. van der Laan)

Pull request description:

  This is based off of #11622 and adds a deprecation warning when a BIP70 URL is used.

  Rational:

  - BIP70 increases attack surface in multiple ways and is difficult for third party wallets to implement in a secure manner
  - Very few merchants use the standard BIP70 variant supported by Bitcoin Core
  - The one major payment processor that doesn't support BIP21 and currently uses a customized non-standard version of BIP70 has indicated that "Unfortunately the original BIP70 is not useful for us."

Tree-SHA512: 1e16ee8d2cdac9499f751ee7b50d058278150f9e38a87a47ddb5105dd0353cdedabe462903f54ead6209b249b249fe5e6a10d29631531be27400f2f69c25b9b9
2018-10-24 16:29:50 +02:00
Wladimir J. van der Laan 2e15fa16cd
Merge #12842: Prevent concurrent savemempool
585b47cfe1 rpc: Prevent concurrent savemempool (João Barbosa)

Pull request description:

  Follow up of #12172, this change prevents calling `savemempool` RPC concurrently.

Tree-SHA512: 4759a7107658a9794f5c6ab7e3e3002276abadd64996010be67a2791914d284db6fe0377c071a8d6a42387bfb0178f219b73aeec077ce5c4fe5c634a30b3e081
2018-10-24 15:20:33 +02:00
MarcoFalke 9dda5fdf64
Merge #14296: [wallet] Remove addwitnessaddress
2b91e42ece [docs] Add release note for removing getwitnessaddress (John Newbery)
ebec90ac97 [wallet] Remove deprecated addwitnessaddress RPC method (John Newbery)
07e3f585ab [test] Remove deprecated addwitnessaddress from feature_segwit.py (John Newbery)
82f2fa03a5 [test] Remove deprecated addwitnessaddress from wallet_bumpfee.py (John Newbery)
9d7ee187a3 [test] Remove deprecated addwitnessaddress from p2p_compactblocks.py (John Newbery)
3cf77f0b3e [tests] Remove deprecated addwitnessaddress call from wallet_dump.py (John Newbery)
bdefc9705d [tests] Remove deprecated addwitnessaddress call from feature_nulldummy (John Newbery)
67d7d67cf3 [test] Fix flake8 warnings in tests (John Newbery)

Pull request description:

  Fully removes the `addwitnessaddress` RPC method, which was deprecated in V0.17

Tree-SHA512: 8fa8a2a721a81262fbdedbe1cef031e6a07aa6abbc9760dbc62738fc4f688b44bd737d0f3cdb1aec046866a6395befbfecde0f34e76a99e11d3cf566cad1d0de
2018-10-24 08:09:48 -04:00
MarcoFalke e895fdc9fc
Merge #11634: wallet: Add missing cs_wallet/cs_KeyStore locks to wallet
69e7ee2dd8 Add GUARDED_BY(cs_wallet) for setExternalKeyPool, mapKeyMetadata, m_script_metadata and setLockedCoins (practicalswift)
37b2538c2d Add GUARDED_BY(cs_wallet) for encrypted_batch, nWalletMaxVersion, m_max_keypool_index and nOrderPosNext (practicalswift)
dee42927c9 wallet: Add Clang thread safety analysis annotations (practicalswift)
1c7e25db0c wallet: Add missing locks (practicalswift)

Pull request description:

  Add missing wallet locks:

  * Calling the function `GetConflicts(...)` requires holding the mutex `cs_wallet`
  * Calling the function `IsSpent(...)` requires holding the mutex `cs_wallet`
  * Accessing the variables `mapKeys` and `mapCryptedKeys` requires holding the mutex `cs_KeyStore`
  * Accessing the variable `nTimeFirstKey` requires holding the mutex `cs_wallet`
  * Accessing the variable `mapWallet` requires holding the mutex `cs_wallet`
  * Accessing the variable `nTimeFirstKey` requires holding the mutex `cs_wallet`

Tree-SHA512: 8a7b9a4e1f2147e77c04b817617a06304a2e2159148d3eb3514a3c09c41d77ef7e773df6e63880ad9acc026e00690f72d0c51f3f86279177f672d477423accca
2018-10-24 05:01:29 -04:00
MarcoFalke 5473e255f6
Merge #14444: Add compile time checking for cs_main locks which we assert at run time
0089905361 Add compile time checking for cs_main locks which we assert at run time (practicalswift)

Pull request description:

  Assert locking requirements at compile-time (`EXCLUSIVE_LOCKS_REQUIRED(foo)`) instead of at run-time (`AssertLockHeld(…)`).

Tree-SHA512: f4965ebf4bb5dbf5e7ed738cacf82c0f6cd55134fb968860bf84a84e29806485617f223910bb8c5461213f1829b0137c64ba1f6d6a2008b3cac3bb3a28df9324
2018-10-23 20:33:07 -04:00
MarcoFalke 94cf1ec948
Merge #14417: Fix listreceivedbyaddress not taking address as a string
d4d70eda33 Fix listreceivedbyaddress not taking address as a string (Eric Scrivner)

Pull request description:

  Fixes #14173. Add the patch in #14173 and include a regression test.

Tree-SHA512: 5a9794e0c43e90d18c899841afbaf15eb9129d7d2f6570fccf0a1793697fe170d224c3c3995b1a35c536fac19819042823d9e3bd23b019d0f03434499243d2f5
2018-10-23 19:04:10 -04:00
MarcoFalke 3668bb335c
Merge #14468: [wallet] Deprecate generate RPC method
ab9aca2bdf [rpc] add 'getnewaddress' hint to 'generatetoaddress' help text. (John Newbery)
c9f02955b2 [wallet] Deprecate the generate RPC method (John Newbery)
aab81720de [tests] Add generate method to TestNode (John Newbery)
c269209336 [tests] Small fixups before deprecating generate (John Newbery)

Pull request description:

  Deprecates the `generate` RPC method.

  For concept discussion, see #14299.

  Fixes #14299.

Tree-SHA512: 16a3b8b742932e4f0476c06b23de07a34d9d215b41d9272c1c9d1e39966b0c2406f17c5ab3cc568947620c08171ebe5eb74fd7ed4b62151363e305ee2937cc80
2018-10-23 18:15:21 -04:00
John Newbery ab9aca2bdf [rpc] add 'getnewaddress' hint to 'generatetoaddress' help text. 2018-10-23 08:32:00 -04:00
James Hilliard 48439b3c10 Don't link SSL_LIBS with GUI unless BIP70 is enabled 2018-10-22 04:10:40 -06:00
James Hilliard fbb643d2a5 Add BIP70 deprecation warning 2018-10-22 04:10:40 -06:00
Wladimir J. van der Laan 38b98507cd qt: cleanup: Move BIP70 functions together in paymentserver
Reduces the number of separate `#ifdefs` spans.
2018-10-22 04:03:17 -06:00
Pieter Wuille ff37459abc Add tests for key origin support 2018-10-20 20:29:02 -07:00
Pieter Wuille 2c6281f180 Add key origin support to descriptors 2018-10-20 20:29:02 -07:00
MarcoFalke 75795603dd
Merge #13909: validation: Pass chainparams in AcceptToMemoryPoolWorker(...)
97ddc6026b validation: Pass chainparams in AcceptToMemoryPoolWorker(...) (practicalswift)

Pull request description:

  Remove unused `CChainParams` argument in `AcceptToMemoryPoolWorker(...)`.

  After the merge of #13527 ("policy: Remove promiscuousmempoolflags") yesterday the `CChainParams` argument is no longer used in `AcceptToMemoryPoolWorker(...)`.

Tree-SHA512: f1bab4498b64f0ab5230b8172f860df8fa8a302e4ee7385be4ba9c65a37cbc3ef640df78348c477169b9414e5c6a160a0b6471a11f4bb27921500ec208ef5340
2018-10-20 21:17:53 -03:00
Wladimir J. van der Laan 96c409c919
Merge #14527: qa: Revert "Make qt wallet test compatible with qt4"
fadffae17f Revert "Make qt wallet test compatible with qt4" (MarcoFalke)

Pull request description:

  This removes the file added in #10098

Tree-SHA512: 4aa887ec02aec943f3d74f469c935acf57e43ddbea6f979bb37d3a14670571fa2276cf578e8978de92b5854d8b462f24e5e0addfb27b92fbedf90726eb5d985e
2018-10-20 14:02:02 +02:00
João Barbosa 585b47cfe1 rpc: Prevent concurrent savemempool 2018-10-20 11:12:20 +01:00
MarcoFalke fadffae17f
Revert "Make qt wallet test compatible with qt4"
This reverts commit e9a64615c8.
2018-10-20 05:34:53 -03:00
Pieter Wuille 91482e5bf2
Merge #14460: tests: Improve 'CAmount' tests
29ed2d64f6 Improve CAmount tests (Hennadii Stepanov)

Pull request description:

  This provides:
    - more `MoneyRange` tests;
    - new `CFeeRate` constructor tests with zero byte size;
    - explicit using of the `CAmount` type.

Tree-SHA512: ca0ad6ccb37909a2a5c11034dc07b316a84c32fb40c6f8b6cfc28ebec72a1de157f31d22e767ae80d70ed06d7296f23870cc5ed0689f34a754ae763d50e23d43
2018-10-19 19:23:43 -07:00
Pieter Wuille e754c6e331
Merge #14011: Disable wallet and address book Qt tests on macOS minimal platform
a3197c5294 Disable wallet and address book Qt tests on macOS minimal platform (Russell Yanofsky)

Pull request description:

  macOS minimal platform is frequently broken, and these are currently failing with Qt 5.11.1.

  The tests do pass when run on the full cocoa platform (with `test_bitcoin-qt -platform cocoa`).

  Stack trace from test crash: https://gist.github.com/ryanofsky/3401fb63c52d13d5585e7fc777361f1e

Tree-SHA512: a05644ef15d75ea7d7f85ea804c6a5fe78e4e7358b189cbab639d9f7dc46163a35f77f7a2b4ae2fd6be5b9fb22898386b4d88069d5ee8d5fdbd995157c6f0846
2018-10-19 19:14:07 -07:00
Pieter Wuille dc1e54206d
Merge #14474: bitcoin-tx: Use constant for n pubkeys check
1f01fe0257 bitcoin-tx: Use constant for n pubkeys check (Antoine Le Calvez)

Pull request description:

  Use the constant for the maximum number of public keys in a multisig script defined in script/script.h instead of hardcoding it.

Tree-SHA512: 83e6c46df907944d0d993159955e402784415536d61fdb5a5becba2b042e37ad2a291b27301c1b169416cb71c823a571d82257512cd4a64848a27a24c875fcc6
2018-10-19 19:02:41 -07:00
Pieter Wuille b2863c0685
Merge #14426: utils: Fix broken Windows filelock
369244f654 utils: Fix broken Windows filelock (Chun Kuan Lee)

Pull request description:

  Fix broken filelock on Windows, also add a test for this. It's a regression introduced by #13862.

Tree-SHA512: 15665b1930cf39ec71f3ab07def8e2897659f6fd4d2de749d63a5a8ec920e4a04282f12bc262f242b1b3d14d2dd9fa191ddbcf16a46fb927b5b2b14d9f6b5d01
2018-10-19 18:59:47 -07:00
Pieter Wuille b14db5abab
Merge #14513: Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG
bc60c615a5 Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG (practicalswift)

Pull request description:

  Avoid `1 << 31` (UB) in calculation of `SEQUENCE_LOCKTIME_DISABLE_FLAG`.

  Context: https://github.com/bitcoin/bitcoin/pull/14510#issuecomment-431153707

Tree-SHA512: bdb4a913c6a82ff1a455ba67d3351f6408ff4116574329361644b483fea96b801fdc5c5659233856b591cd3a46ec669d3b5b438553e4240d7099c560eae2e2ae
2018-10-19 18:52:42 -07:00
Chun Kuan Lee cb53b825c2 scripted-diff: Replace boost::bind with std::bind
-BEGIN VERIFY SCRIPT-
for j in $(seq 1 5)
do
    sed -i "s/ _${j}/ std::placeholders::_${j}/g" $(git grep --name-only " _${j}" -- '*.cpp' '*.h')
done
sed -i "s/boost::bind/std::bind/g" $(git grep --name-only boost::bind -- '*.cpp' '*.h')
sed -i "s/boost::ref/std::ref/g" $(git grep --name-only boost::ref -- '*.cpp' '*.h')
sed -i '/boost\/bind/d' $(git grep --name-only boost/bind)
-END VERIFY SCRIPT-
2018-10-20 02:29:59 +08:00
Chun Kuan Lee 2196c51821 refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform 2018-10-20 02:29:35 +08:00
João Barbosa 3be209d103 rpc: Always throw in getblockstats if -txindex is required
Previously blocks with only the coinbase transaction didn't cause
the RPC error even if the requested stats required -txindex and
it wasn't enabled.
2018-10-19 15:28:41 +01:00
mruddy a4edb168b6 ZMQ: add options to configure outbound message high water mark, aka SNDHWM 2018-10-19 07:36:13 -04:00
Wladimir J. van der Laan 8eb2cd1dda
Merge #14291: wallet: Add ListWalletDir utility function
d56a068935 docs: Add release notes for listwalletdir RPC (João Barbosa)
0cb3cad166 qa: Add tests for listwalletdir RPC (João Barbosa)
cc3377360c rpc: Add listwalletdir RPC (João Barbosa)
d1b03b8e5f interfaces: Add getWalletDir and listWalletDir to Node (João Barbosa)
fc4db35bfd wallet: Add ListWalletDir utility (João Barbosa)

Pull request description:

  `ListWalletDir` returns all available wallets in the current wallet directory.

  Based on MeshCollider work in pull #11485.

Tree-SHA512: 5843e3dbd1e0449f55bb8ea7c241a536078ff6ffcaad88ce5fcf8963971d48c78600fbc4f44919523b8a92329d5d8a5f567a3e0ccb0270fdd27366e19603a716
2018-10-19 01:01:17 +02:00
João Barbosa 321decffa1 rpc: Fix wallet unload during walletpassphrase timeout 2018-10-18 23:33:36 +01:00
João Barbosa cc3377360c rpc: Add listwalletdir RPC 2018-10-18 23:26:06 +01:00
João Barbosa d1b03b8e5f interfaces: Add getWalletDir and listWalletDir to Node 2018-10-18 23:26:06 +01:00
João Barbosa fc4db35bfd wallet: Add ListWalletDir utility
ListWalletDir returns all available wallets in the current wallet directory.

Based on MeshCollider work in pull #11485.
2018-10-18 23:26:06 +01:00
John Newbery c9f02955b2 [wallet] Deprecate the generate RPC method 2018-10-18 17:46:48 -04:00
practicalswift bc60c615a5 Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG 2018-10-18 23:14:20 +02:00
Wladimir J. van der Laan 3715b2489e
Merge #14510: Avoid triggering undefined behaviour in base_uint<BITS>::bits()
96f6dc9fc5 Avoid triggering undefined behaviour in base_uint<BITS>::bits() (practicalswift)

Pull request description:

  Avoid triggering undefined behaviour in `base_uint<BITS>::bits()`.

  `1 << 31` is undefined behaviour in C++11.

  Given the reasonable assumption of `sizeof(int) * CHAR_BIT == 32`.

Tree-SHA512: 995fa38e71c8921873139ecf1b7dd54178555219af3be60d07290f379439ddd8479e3963c6f3cae8178efb61063a0f9add6cba82a5578d13888597b5bcd54f22
2018-10-18 22:55:44 +02:00
Chun Kuan Lee 369244f654 utils: Fix broken Windows filelock 2018-10-19 02:29:25 +08:00
Wladimir J. van der Laan fe23553edd
Merge #14374: qt: Add "Blocksdir" to Debug window
2ab9140c92 Add tooltips for both datadir and blocksdir (Hennadii Stepanov)
3045704502 Add "Blocksdir" to Debug window (Hennadii Stepanov)

Pull request description:

  To get the current `blocksdir` is valuable for debug purposes after
  merging #12653.

  ![screenshot from 2018-10-02 23-16-52](https://user-images.githubusercontent.com/32963518/46374770-2ef6f580-c69a-11e8-85c2-44a49fa36b28.png)

Tree-SHA512: a93f2c00ee19cf6acb499d3bd9bccf4be8ef01c53c44d917ad401aa4797db02cbccb71a9c24e05262ea09345e15f9299381367fdc6951f21dd3788a4a58d2132
2018-10-18 12:31:20 +02:00
Wladimir J. van der Laan 32c5f188d4
Merge #14177: qt: Set C locale for amountWidget
b0510d78ae Set C locale for amountWidget (Hennadii Stepanov)

Pull request description:

  Fix #13873

Tree-SHA512: ef26b35ef83c3a87ebd90650f6d833b00a24f6c114b68fe01acd4a14d1f5bdec066f438eb7781c1e55c32640838c54e00b8f082c390639ade8d9a58830833d4a
2018-10-18 12:26:16 +02:00
practicalswift 96f6dc9fc5 Avoid triggering undefined behaviour in base_uint<BITS>::bits() 2018-10-18 11:17:05 +02:00
Wladimir J. van der Laan d98777f302
Merge #14146: wallet: Remove trailing separators from -walletdir arg
2d471636eb wallet: Remove trailing separators from -walletdir arg (Pierre Rochard)
ea3009ee94 wallet: Add walletdir arg unit tests (Pierre Rochard)

Pull request description:

  If a user passes in a path with a trailing separator as the `walletdir`, multiple BerkeleyEnvironments may be created in the same directory which can lead to data corruption.

  Discovered while reviewing https://github.com/bitcoin/bitcoin/pull/12493#issuecomment-417147646

Tree-SHA512: f2bbf1749d904fd3f326b88f2ead58c8386034355910906d7faea155d518642e9cd4ceb3cae272f2d9d8feb61f126523e1c97502799d24e4315bb53e49fd7c09
2018-10-18 10:58:59 +02:00
Wladimir J. van der Laan 9c5f0d542d
Merge #13878: utils: Add fstream wrapper to allow to pass unicode filename on Windows
43c7fbb1e7 Make MSVC compiler read the source code using utf-8 (Chun Kuan Lee)
f86a571edb tests: Add test case for std::ios_base::ate (Chun Kuan Lee)
a554cc901a Move boost/std fstream to fsbridge (Chun Kuan Lee)
86eb3b3f1a utils: Add fsbridge fstream function wrapper (Chun Kuan Lee)

Pull request description:

  If compiled with mingw, use glibc++ extension `stdio_filebuf` to open the file by `FILE*` instead of filename.

  In other condition, we can use boost::fstream.

Tree-SHA512: b5dbd83e347fb9b2a0c8b1c2c7bd71a272e839ec0617883b2a0ec12506ae9e825373cf6e95b9bcc91d7edc85bf51580a7716b56a9ecaad776bc3ae61638cb3da
2018-10-18 10:36:51 +02:00
Wladimir J. van der Laan 041224a75c
Merge #14472: [doc] getblocktemplate: use SegWit in example
d562027079 [doc] getblocktemplate: use SegWit in example (Sjors Provoost)

Pull request description:

  Make it less likely for new miners to accidentally mine non-SegWit blocks.

  Suggest backport to 0.17 so the docs on bitcoincore.org get updated at the next minor release.

Tree-SHA512: fc8c51690559d3e64d03c0eec433c75e5581d616d36b529e16f89ff2433457386feba7ef3b0d22f245d3f725183a2204fef7ee13e25cb92b945ab61f99068dee
2018-10-18 09:54:33 +02:00
Jonas Schnelli 816fab9cca
Merge #14450: qt: Fix QCompleter popup regression
081cc02a9 Fix QCompleter popup regression (Hennadii Stepanov)

Pull request description:

  The PR #8129 has introduced a regression with the `QCompleter` popup in the Debug window.

  How to reproduce:

  1.  open the Debug window;
  2.  go to the 'Console' tab;
  3.  start writing some RPC command and try to pick it from the list using arrow keys, press Enter.

  Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup.

  The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10.
  This PR fixes this regression.

  Refs:

  - #7613
  - #7772
  - #8129

Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
2018-10-17 20:25:35 +02:00
James O'Beirne b191c7dfb7 doc: add comment explaining recentRejects-DoS behavior
When we receive invalid txs for the first time, we mark the sender as
misbehaving. If we receive the same tx before a new block is seen, we *don't*
punish the second sender (in the same way we do the original sender). It wasn't
initially clear to me that this is intentional, so add a clarifying comment.
2018-10-16 13:04:42 -04:00
Wladimir J. van der Laan 23419e4c49
Merge #14335: net: refactor: cleanup ThreadSocketHandler
032488e6e7 Move SocketHandler logic to private method. (Patrick Strateman)
2af9cff11a Move InactivityCheck logic to private method. (Patrick Strateman)
7479b63d91 Move DisconnectNodes logic to private method. (Patrick Strateman)
edb5350c32 Move NotifyNumConnectionsChanged logic to private method. (Patrick Strateman)

Pull request description:

  Working towards using poll() on unix like systems.

  A number of small changes designed to separate the actual socket handling from the rest of the logic in ThreadSocketHandler.

  This is a simpler version of #14147

Tree-SHA512: 72f35c8ef7649019dcbfe19537d8c9f7e3d0fc5854dc691a70c5573352230fc31c3f55565820c632e9b8cb3c55b878bed19e0ad9423100762197ac35967d8067
2018-10-16 17:20:34 +02:00
Wladimir J. van der Laan 2468471e13
Merge #14403: qt: Revert "Force TLS1.0+ for SSL connections"
7d173c4cd1 qt: Revert "Force TLS1.0+ for SSL connections" (Tim Ruffing)

Pull request description:

  This reverts commit 15e26a6a9a, whose
  purpose was to tweak the Qt configuration to force TLS, i.e., to
  disable SSLv3, in Qt versions >= 5.5. However, the default behavior
  of Qt >= 5.4 is to disable SSLv3 anyway [1], so the configuration
  tweak is redundant.

  With Qt 5.11.2, the configuration tweak is not only redundant but in
  fact provokes a deadlock due to a bug in Qt 5.11.2. Since the deadlock
  occurs at the early startup stage of bitcoin-qt, it renders bitcoin-qt
  entirely non-functional when compiled against Qt 5.11.2 (and maybe
  other Qt versions).

  Fixes #14359.

  [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3fd2d9eff8c1f948306ee5fbfe364ccded1c4b84

Tree-SHA512: 9dd86557b8d265dfa56592924778a736590f2e6a0b2acf77d4f9f4200206a9edaa79b144b0085ea59ac0cc1bc66d9740402fd02f9298ff74c8d6f526f3f725d6
2018-10-16 07:04:22 +02:00
Wladimir J. van der Laan 9bd3ff430b
Merge #14383: qt: Clean system tray icon menu for '-disablewallet' mode
36323e2ac6 Clean systray icon menu for -disablewallet mode (Hennadii Stepanov)

Pull request description:

  There is a `Debug window` leftover in the system tray icon menu after #3392 merging.
  This PR makes both the app menu and the systray icon menu consistent.

Tree-SHA512: c9ef58785fe2a54bc6f778140a16001748ed8c46da948656822b86fdc2e224203cd467857f71d00ce56fc73ff2590c46d8c234a54c261c1141d83039de6fee1e
2018-10-16 06:54:07 +02:00
Jonas Schnelli 2a2cac7873
Merge #14424: Stop requiring imported pubkey to sign non-PKH schemes
2f6b466ae Stop requiring imported pubkey to sign non-PKH schemes (Pieter Wuille)

Pull request description:

  ...

  This is a fix for #14415

Tree-SHA512: 113b4ddfbdfcce7dbaa15c565ac7ec68d16127aa4d47628e0801f2437cbe369e0fa8beb0de191d43dcb2f8cbb6f1bf8d79a5db0f4e352f38fe7280124475710a
2018-10-15 12:50:02 +02:00
Chun Kuan Lee b7df96f456 refactor: Drop boost::this_thread::interruption_point and boost::thread_interrupted in main thread 2018-10-15 10:32:43 +08:00
Eric Scrivner d4d70eda33 Fix listreceivedbyaddress not taking address as a string
Fixes #14173. Add the patch in #14173 and include a regression test.
2018-10-14 09:48:06 -07:00
whythat 93d1aa9abc rpcwallet: add 'ischange' field to 'getaddressinfo' response 2018-10-13 19:30:13 +03:00
Hennadii Stepanov 081cc02a98
Fix QCompleter popup regression
The PR #8129 has introduced a regression with the QCompleter popup in
the Debug window.

How to reproduce:
  1) open the Debug window;
  2) go to the 'Console' tab;
  3) start writing some rpc command and try to pick it from the list
using arrow keys, press Enter.
Note that the popup used to display completions is not being closed. To
close it they should mouse click somewhere outside of the popup.
2018-10-13 14:19:38 +03:00
Antoine Le Calvez 1f01fe0257 bitcoin-tx: Use constant for n pubkeys check
Use the constant for the maximum number of public keys in a multisig
script defined in script/script.h instead of hardcoding it.
2018-10-13 10:55:51 +01:00
Sjors Provoost d562027079
[doc] getblocktemplate: use SegWit in example 2018-10-13 17:15:08 +09:00
Hennadii Stepanov 29ed2d64f6
Improve CAmount tests
This provides:
  - more `MoneyRange` tests;
  - new `CFeeRate` constructor tests with zero byte size;
  - explicit using of the `CAmount` type.
2018-10-10 23:27:51 +03:00
practicalswift 0089905361 Add compile time checking for cs_main locks which we assert at run time 2018-10-10 11:28:43 +02:00
MarcoFalke be992701b0
Merge #14373: Consistency fixes for RPC descriptions
b8edb9810a [rpc] Descriptions: Textual consistency fixes (Jon Layton)

Pull request description:

Tree-SHA512: fa22ddac94e95672579cc84309f1c3ea3a2dbf762e45a8ae9c121c4c5188bf8c19ff9458d49dd7ef760c3ae4226487612a2954e9a1a0e8b720116afeb718b46b
2018-10-10 00:59:57 -03:00
James O'Beirne a48e44bd4f Fix CLEAN_BITCOIN_TEST to remove .log files for all BITCOIN_TESTS files 2018-10-09 22:31:51 -04:00
Jordan Baczuk 0c69ff6171 clarify rpcwallet flag url change 2018-10-09 13:49:07 -06:00
Jon Layton b8edb9810a [rpc] Descriptions: Textual consistency fixes
'Must be one of' should always end in a ':'

'hex encoded' is now always 'hex-encoded'

Remove redundant '(defaults to CONSERVATIVE)' text from estimatesmartfee

Consistent spacing for options '( verbose )' and '( verbosity )'

'BIP125 replaceable' is now always 'BIP125-replaceable'

JSON-RPC example is now always 'As a JSON-RPC call'
2018-10-09 08:42:19 -05:00
practicalswift 69e7ee2dd8 Add GUARDED_BY(cs_wallet) for setExternalKeyPool, mapKeyMetadata, m_script_metadata and setLockedCoins 2018-10-09 15:04:26 +02:00
practicalswift 37b2538c2d Add GUARDED_BY(cs_wallet) for encrypted_batch, nWalletMaxVersion, m_max_keypool_index and nOrderPosNext
* AddKeyPubKeyWithDB(...) reads encrypted_batch which potentially races with write in the same method.
* IncOrderPosNext(...) reads nOrderPosNext which potentially races with write in BlockDisconnected(...).
* LoadKeyPool(...) reads m_max_keypool_index which potentially races with write in BlockDisconnected(...).
* LoadMinVersion(...) reads nWalletMaxVersion which potentially races with write in BlockDisconnected(...).
2018-10-09 12:12:27 +02:00
practicalswift dee42927c9 wallet: Add Clang thread safety analysis annotations 2018-10-09 11:58:32 +02:00
practicalswift 1c7e25db0c wallet: Add missing locks 2018-10-09 11:58:32 +02:00
Tim Ruffing 7d173c4cd1 qt: Revert "Force TLS1.0+ for SSL connections"
This reverts commit 15e26a6a9a, whose
purpose was to tweak the Qt configuration to force TLS, i.e., to
disable SSLv3, in Qt versions >= 5.5. However, the default behavior
of Qt >= 5.4 is to disable SSLv3 anyway [1], so the configuration
tweak is redundant.

With Qt 5.11.2, the configuration tweak is not only redundant but in
fact provokes a deadlock (#14359) due to Qt 5.11.2 being incompatible
with OpenSSL 1.1.1 [2]. Since the deadlock occurs at the early startup
stage of bitcoin-qt, it renders bitcoin-qt entirely non-functional
when compiled against OpenSSL 1.1.1 and Qt 5.11.2 (and possible future
combinations of OpenSSL and Qt versions).

This commit fixes #14359 by removing the redundant code.

[1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3fd2d9eff8c1f948306ee5fbfe364ccded1c4b84
[2] https://bugreports.qt.io/browse/QTBUG-70956
2018-10-09 11:54:05 +02:00
Wladimir J. van der Laan 9dcf6c0dfe build: Add --disable-bip70 configure option
This patch adds a --disable-bip70 configure option that disables BIP70
payment request support. When disabled, this removes the dependency of
the GUI on OpenSSL and Protobuf.
2018-10-09 03:36:14 -06:00
MarcoFalke 1d1417430c
Merge #13115: addrman: Add Clang thread safety annotations for variables guarded by CAddrMan.cs
3e9f6c821b Add missing locks and locking annotations for CAddrMan (practicalswift)

Pull request description:

  * Add Clang thread safety annotations for variables guarded by `CAddrMan.cs `
  * Add missing `CAddrMan.cs ` locks

Tree-SHA512: c78d56d56eb63a4469333c04c95317545a8f97d5e3a36ff2699ee4a91a6433d416221eed6c5ff168e1e31f6936c2ae101a4c60b635f2b2309f40e3d66a727322
2018-10-09 00:54:30 -03:00
practicalswift 3e9f6c821b Add missing locks and locking annotations for CAddrMan 2018-10-08 17:19:25 +02:00
Hennadii Stepanov 2ab9140c92
Add tooltips for both datadir and blocksdir 2018-10-08 13:33:29 +03:00
MarcoFalke da32bd80bf
Merge #14253: Build: during 'make clean', remove some files that are currently missed.
3f5ac27205 Include some files currently missed by 'make distclean'. (murrayn)

Pull request description:

  `make clean` currently leaves behind some cache and test log files that should be removed.

Tree-SHA512: a1877e776e24232f6dd1468d7f392ea0bd1e93fdd975e623897d48c4b23a080a2e84ebb199f5482abd6b8c9ddd036850325e7b7ed07e2f9fe7a32f83cc99da4a
2018-10-08 04:32:48 -03:00
MarcoFalke 35e12e336b
Merge #14428: docs: Fix macOS files description in qt/README.md
0bd64dc6d6 Fix macOS files description (Hennadii Stepanov)

Pull request description:

Tree-SHA512: 9547bda4e2bcd2c823b6c344e8d34ebc24770b2926bbec0f5c11f192407386cddf5daaa4fc154f769df708319262ead72e699dab211afa5762a2def6203445fe
2018-10-08 02:54:56 -03:00
Pieter Wuille 2f6b466aeb Stop requiring imported pubkey to sign non-PKH schemes 2018-10-07 22:15:27 -07:00
MarcoFalke 2a747337ae
Merge #14398: tests: Don't access out of bounds array index: array[sizeof(array)]
b09c81454e Don't access out of bounds array entry array[sizeof(array)] (Ben Woosley)

Pull request description:

  Split from #13525

Tree-SHA512: bf44609fc5d497cd1894b85dce33a55977b3e0f3d03b986333a85967c1f3aa89089461f830939072bbb4d2477ccce26b9caeb627215bfb86a331f58d3466a4bd
2018-10-07 23:34:50 -03:00
MarcoFalke 60a61611f6
Merge #13883: utils: Convert Windows args to utf-8 string
380c843217 utils: Convert Windows args to utf-8 string (Chun Kuan Lee)

Pull request description:

  Create a new class `WinCmdLineArgs` when building for Windows. It converts all command line arguments to utf8 string.

Tree-SHA512: f098520fd123a8a452bc84a55dc8c0b88f0c475410efe57f2ccc393f86c396eed59ea1575ddc1b920323792e390fdb092061d80cdcd9b682f0ac79a22a22ff82
2018-10-07 22:47:17 -03:00
Hennadii Stepanov 0bd64dc6d6
Fix macOS files description 2018-10-08 00:41:40 +03:00
marcoagner 9d0e52834b
implements different disk sizes for different networks on intro
- Creates m_assumed_blockchain_size and m_assumed_chain_state_size on CChainParams.
- Implements access to CChainParams' m_assumed_blockchain_size and m_assumed_chain_state_size on node interface.
- Implements m_assumed_blockchain_size and m_assumed_chain_state_size on qt/intro via node interface.
- Updates release process document with the new CChainParam's values.
2018-10-07 13:11:36 +01:00
Hennadii Stepanov 36323e2ac6
Clean systray icon menu for -disablewallet mode
Ref #3392
2018-10-06 02:46:45 +03:00
Hennadii Stepanov 3045704502
Add "Blocksdir" to Debug window
To get the current blocksdir is valuable for debug purposes after
merging #12653.
2018-10-06 00:07:05 +03:00
marcoagner a6b5ec18ff
rpc: creates possibility to preserve labels on importprivkey
- changes importprivkey behavior to overwrite existent label if one
is passed and keep existing ones if no label is passed

- tests behavior of importprivkey on existing address labels and
different same key destination
2018-10-05 13:33:21 +01:00
Ben Woosley b09c81454e
Don't access out of bounds array entry array[sizeof(array)] 2018-10-05 16:48:16 +09:00
Andrew Chow 4fb3388db9 check that a separator is found for psbt inputs, outputs, and global map 2018-10-03 00:26:10 -04:00
murrayn 3f5ac27205 Include some files currently missed by 'make distclean'. 2018-10-01 02:17:44 -07:00
MarcoFalke 011c39c296
Merge #14331: doxygen: Fix member comments
fa69ac7614 doxygen: Fix member comments (MarcoFalke)

Pull request description:

  Trailing comments must be indicted with the caret `//!<`.

  Not all places do this right now, see for example https://dev.visucore.com/bitcoin/doxygen/txmempool_8h.html#a2bc6653552b5871101b6cbefdbaf251f, but they can be fixed with an almost-scripted-diff:

  ```
  sed -i --regexp-extended -e 's/((,|;) *\/\/!) /\1< /g' $(git grep --extended-regexp -l  '(,|;)\s*//!\s')
  ```

  (Same as  [doxygen] Fix member comments #7793)

Tree-SHA512: 451077008353ccc6fcc795f34094b2d022feb7a171b562a07ba4de0dcb0aebc137e12b03970764bd81e2da386751d042903db4c4831900f43c0cfde804c81b2b
2018-09-30 22:15:37 -03:00
Chun Kuan Lee 380c843217 utils: Convert Windows args to utf-8 string 2018-09-30 15:08:16 +08:00
Gregory Sanders 88a79cb436 fix converttopsbt permitsigdata arg, add basic test 2018-09-29 22:09:15 -04:00
MarcoFalke 134b42a409
Merge #14244: amount: Move CAmount CENT to unit test header
fa84723e73 amount: Move CAmount CENT to unit test header (MarcoFalke)

Pull request description:

  `CAmount` is currently not type-safe. Exporting a constant (`CENT`) that is commonly not referred to by that name might be confusing. `CENT` is only used in two places prior to this commit (`ParseMoney` and `MIN_CHANGE`). So replace these with constants relative to `COIN` and move `CENT` to the unit test header.

Tree-SHA512: 5273e96d8664ced6ae211abde2e20bc763e6e99f89404eec02c621f29e1d235e5f9b1ade933743843fae16fc24b643f883deda9221e3d9fd31229d2ab63a914f
2018-09-27 12:02:17 -04:00
MarcoFalke 01211cea71
Merge #14307: Consolidate redundant implementations of ParseHashStr
9c5af58d51 Consolidate redundant implementations of ParseHashStr (Ben Woosley)

Pull request description:

  This change:
  * adds a length check to all calls to `ParseHashStr`, appropriate given its use to populate
    a 256-bit number from a hex str
  * allows the caller to handle the failure, which allows for the more
    appropriate `JSONRPCError` on failure in `prioritisetransaction` rpc

  Relative to #14288

Tree-SHA512: baa791147e5ceb3c30c70df3981aaf807bf7d4a90a0be3625540b59aa4b9a9d303a452bfef18bf167cbb833ef9591b4ef5948bf4a1ce67b421d804ae8d20ea53
2018-09-27 11:26:29 -04:00
MarcoFalke 423cb37658
Merge #14027: Skip stale tip checking if outbound connections are off or if reindexing.
66b3fc5437 Skip stale tip checking if outbound connections are off or if reindexing. (Gregory Maxwell)

Pull request description:

  I got tired of the pointless stale tip notices in reindex and on nodes with connections disabled.

Tree-SHA512: eb07d9c5c787ae6dea02cdd1d67a48a36a30adc5ccc74d6f1c0c7364d404dc8848b35d2b8daf5283f7c8f36f1a3c463aacb190d70a22d1fe796a301bb1f03228
2018-09-27 11:18:47 -04:00
MarcoFalke b88dd7c2db
Merge #12246: Bugfix: Only run bitcoin-tx tests when bitcoin-tx is enabled
a2a04a5abb Bugfix: Only run bitcoin-tx tests when bitcoin-tx is enabled (Luke Dashjr)
92af71cea9 configure: Make it possible to build only one of bitcoin-cli or bitcoin-tx (Luke Dashjr)

Pull request description:

  Includes #5618 (which the reasons for rejecting no longer hold true)

Tree-SHA512: f30a8e4a2f70166b7cabef77c4674163b3a9da14c6a547d34f00d1056a19bf4d23e22851eea726fad2afc8735d5473ae91122c770b65ac3886663dc20e2c5b70
2018-09-27 11:13:51 -04:00
Hennadii Stepanov ec1201a368
Don't use systray icon on inappropriate systems
Prevent a user from losing access to the main window by minimizing it to
the tray on some systems (e.g. GNOME 3.26+).
2018-09-27 17:24:04 +03:00
MarcoFalke ae1cc010b8
Merge #14282: [wallet] Remove -usehd
7ac911afe7 [docs] Add release notes for removing `-usehd` (John Newbery)
25548b2958 [wallet] Remove -usehd (John Newbery)

Pull request description:

  `-usehd` is no longer used (except to tell the user that they've set it incorrectly for the wallet that they're loading). Remove it (in the same spirit as #14272)

Tree-SHA512: 5bdcd2bb9bb8504a01343595bcd1bd433d97b730255152c725103c1ac3fa3a9d9e5220a4c29d4c72307cf803e1c09d31080f83603c23dc77263846e17b1826f0
2018-09-26 17:36:28 -04:00
MarcoFalke fa69ac7614
doxygen: Fix member comments 2018-09-26 15:42:21 -04:00
Hennadii Stepanov b0510d78ae
Set C locale for amountWidget
Fix #13873
2018-09-26 22:28:10 +03:00
MarcoFalke d799efe214
Merge #14310: [wallet] Ensure wallet is unlocked before signing
20442f617f [wallet] remove redundand restart node (gustavonalle)
db15805668 [wallet] Ensure wallet is unlocked before signing (gustavonalle)

Pull request description:

  Fixes #14082

Tree-SHA512: 200620a2ced934f958933aba34541565a992e5033cf04c4e2be48b99e7708973c85f8274968962cec943f0c1d76fb2faa5e056469bbf59ce7f768614572322f9
2018-09-26 09:18:00 -04:00
Chun Kuan Lee f86a571edb tests: Add test case for std::ios_base::ate 2018-09-26 08:47:42 +08:00
Chun Kuan Lee a554cc901a Move boost/std fstream to fsbridge 2018-09-26 08:47:42 +08:00
Chun Kuan Lee 86eb3b3f1a utils: Add fsbridge fstream function wrapper 2018-09-26 08:47:42 +08:00
MarcoFalke cc7258bdfb
Merge #13877: utils: Make fs::path::string() always return utf-8 string on Windows
2c3eade704 Make fs::path::string() always return utf-8 string (Chun Kuan Lee)

Pull request description:

  Imbue `fs::path` with `std::codecvt_utf8_utf16` at `SetupEnvironment()`, so that default string encoding will be utf-8 inside `fs::path`.

Tree-SHA512: 0cb59464d777278decbf24771fc5ff0cb2caa7bc2fe8ee5cd36c97a2324873a3caad131f08f050393b488316ee7f4ab0b28b7fa4699e41839f8e51b9867d5118
2018-09-25 14:00:46 -04:00
Ben Woosley 9c5af58d51
Consolidate redundant implementations of ParseHashStr
This change:
* adds a length check to ParseHashStr, appropriate given its use to populate
  a 256-bit number from a hex str.
* allows the caller to handle the failure, which allows for the more
  appropriate JSONRPCError on failure in prioritisetransaction rpc
2018-09-25 09:14:52 -07:00
MarcoFalke 4dac24db23
Merge #13311: Don't edit Chainparams after initialization
6fa901fb47 Don't edit Chainparams after initialization (Jorge Timón)
980b38f8a1 MOVEONLY: Move versionbits info out of versionbits.o (Jorge Timón)

Pull request description:

  This encapsulates the "-vbparams" option, which is only meant for regtest, directly on CRegTestParams.

  This is a refactor and doesn't change functionality.

  Related to https://github.com/bitcoin/bitcoin/pull/8994

Tree-SHA512: 79771d729a63a720e743a9c77d5e2d80369f072d66202a43c1304e83a7d0ef7c6103d4968a03aea9666cc89a7203c618da972124a677b38cfe62ddaeb28f9f5d
2018-09-24 17:24:06 -04:00
Patrick Strateman 032488e6e7 Move SocketHandler logic to private method. 2018-09-24 17:08:10 -04:00
Patrick Strateman 2af9cff11a Move InactivityCheck logic to private method. 2018-09-24 17:08:04 -04:00
Patrick Strateman 7479b63d91 Move DisconnectNodes logic to private method. 2018-09-24 16:53:52 -04:00
Patrick Strateman edb5350c32 Move NotifyNumConnectionsChanged logic to private method. 2018-09-24 16:30:53 -04:00
MarcoFalke 37612099ec
Merge #13424: Consistently validate txid / blockhash length and encoding in rpc calls
5eb20f81d9 Consistently use ParseHashV to validate hash inputs in rpc (Ben Woosley)

Pull request description:

  ParseHashV validates the length and encoding of the string and throws
  an informative RPC error on failure, which is as good or better than
  these alternative calls.

  Note I switched ParseHashV to check string length first, because
  IsHex tests that the length is even, and an error like:
  "must be of length 64 (not 63, for X)" is much more informative than
  "must be hexadecimal string (not X)" in that case.

  Split from #13420

Tree-SHA512: f0786b41c0d7793ff76e4b2bb35547873070bbf7561d510029e8edb93f59176277efcd4d183b3185532ea69fc0bbbf3dbe9e19362e8017007ae9d51266cd78ae
2018-09-24 15:09:11 -04:00
gustavonalle db15805668 [wallet] Ensure wallet is unlocked before signing 2018-09-24 18:13:22 +01:00
practicalswift 97ddc6026b validation: Pass chainparams in AcceptToMemoryPoolWorker(...) 2018-09-24 16:03:06 +02:00
MarcoFalke 985d28cc90
Merge #14297: [RPC] Remove warning for removed estimatefee RPC
1eb9a9b524 [RPC] Remove warning for removed estimatefee RPC (John Newbery)

Pull request description:

  The  RPC was removed in a previous version, but a warning was
  left for users to use the estimatesmartfee RPC. Remove that warning now
  that estimatefee has been gone for over one version.

Tree-SHA512: 7fb440a354a5058f9e95930306d7fe0c1cba6563b9a44b7388a17d9e5c3cff42023f5aa1728fd94a1a11249ea4a8615a8a891afe4fa81ae46b61c2aa08e9cc47
2018-09-24 08:20:57 -04:00
MarcoFalke f5035f9d0f
Merge #14298: [REST] improve performance for JSON calls
30973e9844 [REST] improve performance for JSON calls (Antoine Le Calvez)

Pull request description:

  JSON calls do not use the raw data generated for the .bin and .hex calls.

  By moving the raw data creation into the .bin and .hex switch branches, JSON calls' performance is improved.

  Light benchmarking indicates that fetching 2000 JSON headers is ~25% faster, fetching large JSON blocks is ~4% faster.

Tree-SHA512: 433552c89bac2469d041b48a4a991d5443e4026a3ad7dc5621685386029f22826484218642fa5130c268349a55524ecbc4e30d64c867bd6632e0edd24370cf11
2018-09-24 07:49:27 -04:00
MarcoFalke e798ae41e0
Merge #13546: wallet: Fix use of uninitialized value bnb_used in CWallet::CreateTransaction(...)
a23a7f60aa wallet: Avoid potential use of unitialized value bnb_used in CWallet::CreateTransaction(...) (practicalswift)

Pull request description:

  Avoid use of uninitialized value `bnb_used` in `CWallet::CreateTransaction(...)`.

Tree-SHA512: 22faf0711ae35af44d9a0ab7f251bc01661ac88b40ad7b0a87a510427b46bbc8caf16868cab2e0a05e7d8518e93ce666d6bd1d48d3707d37bab2c0fb56a0a4a2
2018-09-24 07:37:18 -04:00
Jorge Timón 6fa901fb47
Don't edit Chainparams after initialization 2018-09-23 22:58:54 +02:00
Jorge Timón 980b38f8a1
MOVEONLY: Move versionbits info out of versionbits.o 2018-09-23 22:55:11 +02:00
Antoine Le Calvez 30973e9844 [REST] improve performance for JSON calls
JSON calls do not use the raw data generated for
the .bin and .hex calls. By moving the raw data
creation into the .bin and .hex switch branches,
JSON calls become faster.
2018-09-23 14:12:42 +01:00
John Newbery ebec90ac97 [wallet] Remove deprecated addwitnessaddress RPC method 2018-09-23 08:53:16 -04:00
John Newbery 1eb9a9b524 [RPC] Remove warning for removed estimatefee RPC
The  RPC was removed in a previous version, but a warning was
left for users to use the estimatesmartfee RPC. Remove that warning now
that estimatefee has been gone for over one version.
2018-09-22 23:27:01 -04:00
Chun Kuan Lee 2c3eade704 Make fs::path::string() always return utf-8 string 2018-09-23 03:43:25 +08:00
Andrew Chow f8c1714634 Convert non-witness UTXOs to witness if witness sig created
If a witness signature was created when a non-witness UTXO is used,
convert the non-witness UTXO to a witness one.
2018-09-22 15:27:01 -04:00
MarcoFalke 2796c6e5ec
Merge #14214: convert C-style (void) parameter lists to C++ style ()
3ccfa34b32 convert C-style (void) parameter lists to C++ style () (Arvid Norberg)

Pull request description:

  In C, an empty parameter list, `()`, means the function takes any arguments, and `(void)` means the function does not take any parameters.
  In C++, an empty parameter list means the function does not take any parameters.

  So, C++ still supports `(void)` parameter lists with the same semantics, why change to `()`?

  1. removing the redundant `void` improves signal-to-noise ratio of the code
  2. using `(void)` exposes a rare inconsistency in that a template taking a template `(T)` parameter list, cannot be instantiated with `T=void`

Tree-SHA512: be2897b6c5e474873aa878ed6bac098382cd21866aec33752fe40b089a6331aa6263cae749aba1b4a41e8467f1a47086d32eb74abaf09927fd5a2f44a4b2109a
2018-09-20 17:57:20 -04:00
John Newbery 25548b2958
[wallet] Remove -usehd 2018-09-20 17:26:14 -04:00
MarcoFalke fa910e4301
init: Remove deprecated args from hidden args 2018-09-19 16:47:32 -04:00
MarcoFalke 920c090f63
Merge #14287: tests: Use MakeUnique to construct objects owned by unique_ptrs
b6718e373e tests: Use MakeUnique to construct objects owned by unique_ptrs (practicalswift)

Pull request description:

  A subset of #14211 ("Use MakeUnique to construct objects owned by unique_ptrs") as suggested by @MarcoFalke in https://github.com/bitcoin/bitcoin/pull/14211#issuecomment-423324019.

  Use `MakeUnique` to construct objects owned by `unique_ptr`s.

  Rationale:
  * `MakeUnique` ensures exception safety in complex expressions.
  * `MakeUnique` gives a more concise statement of the construction.

Tree-SHA512: 1228ae6ce7beb178d79142c4e936b728178ccaa8aa35c6d8feeb33d1a667abfdd010c59996a9d833594611e913877ce5794e75953d11d9b1fdbac04aa491d9cf
2018-09-19 13:26:47 -04:00
practicalswift b6718e373e tests: Use MakeUnique to construct objects owned by unique_ptrs 2018-09-21 11:03:21 +02:00
practicalswift a23a7f60aa wallet: Avoid potential use of unitialized value bnb_used in CWallet::CreateTransaction(...) 2018-09-19 14:11:14 +02:00
Ben Woosley 951a44e9cd
Drop unused setRange arg to BerkeleyBatch::ReadAtCursor 2018-09-19 02:36:23 -04:00
MarcoFalke d26278988f
Merge #13152: [rpc] Add getnodeaddresses RPC command
a2eb6f5405 [rpc] Add getnodeaddresses RPC command (chris-belcher)

Pull request description:

  Implements issue https://github.com/bitcoin/bitcoin/issues/9463

  New getnodeaddresses call gives access via RPC to the peers known by the node. It may be useful for bitcoin wallets to broadcast their transactions over tor for improved privacy without using the centralized DNS seeds. getnodeaddresses is very similar to the getaddr p2p method.

  Please advise me on the best approach for writing an automated test. By my reading the getaddr p2p method also isn't really tested.

Tree-SHA512: ad03abf518847476495b76a2f5394b8030aa86654429167fa618e21460abb505c10ef9817ec1b80472320d41d0aff5dc94a8efce023aaaaf5e81386aa92b852b
2018-09-18 19:50:00 -04:00
Karl-Johan Alm bf2e010973
uint256: Remove unnecessary crypto/common.h use 2018-09-18 14:27:05 +09:00
Chun Kuan Lee 82d6c5aad3 gui: Show watch-only eye instead of HD disabled 2018-09-18 11:12:05 +08:00
chris-belcher a2eb6f5405 [rpc] Add getnodeaddresses RPC command
New getnodeaddresses call gives access via RPC to the peers known by
the node. It may be useful for bitcoin wallets to broadcast their
transactions over tor for improved privacy without using the
centralized DNS seeds. getnodeaddresses is very similar to the getaddr
p2p method.

Tests the new rpc call by feeding IP address to a test node via the p2p
protocol, then obtaining someone of those addresses with
getnodeaddresses and checking that they are a subset.
2018-09-17 22:55:23 +01:00
Suhas Daftuar b8f801964f Fix crash bug with duplicate inputs within a transaction
Introduced by #9049
2018-09-17 15:50:55 -04:00
MarcoFalke fa84723e73
amount: Move CAmount CENT to unit test header 2018-09-17 14:34:56 -04:00
Wladimir J. van der Laan 2d4749b366
Merge #13578: [depends, zmq, doc] upgrade zeromq to 4.2.5 and avoid deprecated zeromq api functions
f1bd03eb01 [depends, zmq, doc] upgrade zeromq to 4.2.5 and avoid deprecated zeromq api functions (mruddy)

Pull request description:

  Upgrade the ZeroMQ dependency from version 4.2.3 to the latest stable version 4.2.5.

  This PR Follows the lead of https://github.com/bitcoin/bitcoin/pull/11986.

  I upgraded both patch files to correspond to the version `4.2.5` libzmq files.
  I assume doing so is still necessary and correct.

  Without updating the patch line numbers, things appear to work, but you get extra log messages while building `depends` because things don't exactly match, e.g.:
  ```
  /bitcoin/depends> make zeromq
  Extracting zeromq...
  /bitcoin/depends/sources/zeromq-4.2.5.tar.gz: OK
  Preprocessing zeromq...
  patching file src/windows.hpp
  Hunk #1 succeeded at 58 (offset 3 lines).
  patching file src/thread.cpp
  Hunk #1 succeeded at 307 with fuzz 2 (offset 87 lines).
  Hunk #2 succeeded at 323 with fuzz 2 (offset 90 lines).
  ```
  Updating the patches seemed cleaner, so I did it. Note that libzmq had some whitespace changes, so that's why the updated patches do too.

  More info: https://github.com/zeromq/libzmq/releases/tag/v4.2.5

  tags: libzmq, zmq, 0mq

Tree-SHA512: 78659dd276b5311e40634b1bbebb802ddd6b69662ba3c84995ef1e3795c49a78b1635112c7fd72a405ea36e2cc3bdeb84e6d00d4e491a349bba1dafff50e2fa5
2018-09-17 13:54:42 +02:00
Arvid Norberg be54f42e5f use integer division instead of double conversion and multiplication for computing amounts 2018-09-15 12:45:41 -07:00
MarcoFalke c53e083a49
Merge #14212: build: Remove libssl from LDADD unless gui
cccc362d62 build: Remove libssl from LDADD unless gui (MarcoFalke)

Pull request description:

  libssl is only used by the gui, so no need to LDADD it to the other tools and binaries

  Follow up of the commit which removed rpcssl: 40b556d374

Tree-SHA512: 9dbdf4faf40699cea3a37349ac83dbcacdaa062f5338416ff4ba77924c47d9e148b27218165c5aa3584a1ef4899e0fa237ff571208aa0b98803761e802d1e5dc
2018-09-15 09:35:14 -04:00
Wladimir J. van der Laan de89eec25d
Merge #14206: doc: Document -checklevel levels
8e1c13e6da doc: Document -checklevel levels (Wladimir J. van der Laan)

Pull request description:

  Document the various possible check levels for the command-line argument. The numbers say nothing on their own.

Tree-SHA512: 8a526c53222b55304dde1d9350dd15a50f1dd62bf452a32dc886a4521e3ab49d5f0a86a4c5cbb0d52fb76b60222101045100f93fee5e1a5d5e3ab8e79b64cbe0
2018-09-15 12:01:31 +02:00
Wladimir J. van der Laan 8e1c13e6da doc: Document -checklevel levels
Document the various possible check levels for the command-line
argument. The numbers say nothing on their own.
2018-09-15 10:17:07 +02:00
Wladimir J. van der Laan f09bc7ec98
Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting down
c1dde3a949 No longer shutdown after encrypting the wallet (Andrew Chow)
d7637c5a3f After encrypting the wallet, reload the database environment (Andrew Chow)
5d296ac810 Add function to close all Db's and reload the databae environment (Andrew Chow)
a769461d5e Move BerkeleyEnvironment deletion from internal method to callsite (Andrew Chow)

Pull request description:

  This is the replacement for #11678 which implements @ryanofsky's [suggestion](https://github.com/bitcoin/bitcoin/pull/11678#pullrequestreview-76464511).

  Shutting down the software was to prevent the BDB environment from writing unencrypted private keys to disk in the database log files, as was noted [here](https://bitcointalk.org/index.php?topic=51474.msg616068#msg616068). This PR replaces the shutdown behavior with a CDBEnv flush, close, and reopen which achieves the same effect: everything is cleanly flushed and closed, the log files are removed, and then the environment reopened to continue normal operation.

  To ensure that no unencrypted private keys are in the log files after encrypting the wallet, I wrote [this script](https://gist.github.com/achow101/7f7143e6c3d3fdc034d3470e72823e9d) to pull private keys from the original wallet file and searches for these keys in the log files (note that you will have to change your file paths to make it work on your own machine).

  As for concerns about private keys being written to slack space or being kept in memory, these behaviors no longer exist after the original wallet encryption PR and the shutting down solution from 2011.

  cc @ryanofsky

Tree-SHA512: 34b894283b0677a873d06dee46dff8424dec85a2973009ac9b84bcf3d22d05f227c494168c395219d9aee3178e420cf70d4b3eeacc9785aa86b6015d25758e75
2018-09-14 10:43:35 +02:00
MarcoFalke cccc362d62
build: Remove libssl from LDADD unless gui 2018-09-13 15:53:51 -04:00
Arvid Norberg 3ccfa34b32 convert C-style (void) parameter lists to C++ style () 2018-09-13 10:36:41 -07:00
Wladimir J. van der Laan d73205ef36
Merge #14192: utils: Convert fs::filesystem_error messages from local multibyte to utf-8 on Windows
e221368932 utils: Convert fs error messages from multibyte to utf-8 (Chun Kuan Lee)

Pull request description:

  Before:
  ![default](https://user-images.githubusercontent.com/11154118/45318798-8d83f480-b570-11e8-8cbb-c729a54f6b9e.png)
  After:
  ![2](https://user-images.githubusercontent.com/11154118/45318806-91177b80-b570-11e8-9474-a62342c92dbd.png)

Tree-SHA512: 0a598bd159286f6784d117b8a24888b2650d5402d687ab0e8d0849e0c3d53797e266647d8177bb6614307c9598019cd7477311bb9895b1bb52a6bd77b460fda1
2018-09-13 17:30:27 +02:00
Wladimir J. van der Laan 49fd485bbf
Merge #14208: [build] Actually remove ENABLE_WALLET
e4ef4b4595 [build] remove #ifdef ENABLE_WALLET from interfaces/node (John Newbery)

Pull request description:

  Adds a couple of redefinitions to dummywallet.cpp.

Tree-SHA512: d226bcccc46d089eac88beb54c31f6f18817682994b371f9793a5d28bec5d60dbdffacc8fc281807e25cc7f89da23e1f8f36fd99d12f8a40f77a972840e8c1b4
2018-09-13 15:50:16 +02:00
John Newbery e4ef4b4595 [build] remove #ifdef ENABLE_WALLET from interfaces/node
Removes the final #ifdef ENABLE_WALLET from libbitcoin_server by calling
g_wallet_init_interface.HasWalletSupport(), and redifining GetWallets()
and MakeWallet() in dummywallet.cpp.
2018-09-13 09:37:37 -04:00
MarcoFalke 962c302710
Merge #13983: rpc: Return more specific reject reason for submitblock
fa6ab8ada1 rpc: Return more specific reject reason for submitblock (MarcoFalke)

Pull request description:

  The second commit in #13439 made the `TODO` in the first commit impossible to solve.

  The meaning of `fNewBlock` changed from "This is the first time we process this block" to "We are about to write the new *valid* block".

  So whenever `fNewBlock` is true, the block was valid. And whenever the `fNewBlock` is false, the block is either valid or invalid. If it was valid and not new, we know it is a `"duplicate"`. In all other cases, the `BIP22ValidationResult()` will return the reason why it is invalid.

Tree-SHA512: 4b6edf7a912339c3acb0fccfabbdd6d812a0321fb1639c244c2714e58dc119aa2b8c6bf8f7d61ea609a1b861bbc23f920370fcf989c48452721e259a8ce93d24
2018-09-13 09:28:46 -04:00
Wladimir J. van der Laan b9ed2fd026
Merge #13310: Report progress in ReplayBlocks while rolling forward
b16ab9af07 Report progress in ReplayBlocks while rolling forward (João Barbosa)

Pull request description:

  Fixes #13303.

Tree-SHA512: 9375bda03bd2527018b9d24a25c82fa01a841e41ae2cb5307be61af19e2b759d3a7db76852baba9a286fbcb52f70f427a5ab4375df08215ac439e47e73633e54
2018-09-13 14:07:20 +02:00
Luke Dashjr a2a04a5abb Bugfix: Only run bitcoin-tx tests when bitcoin-tx is enabled 2018-09-13 11:48:25 +00:00
Luke Dashjr 92af71cea9 configure: Make it possible to build only one of bitcoin-cli or bitcoin-tx 2018-09-13 11:48:23 +00:00
Wladimir J. van der Laan 37b836ad09
Merge #13888: Call unicode API on Windows
d38bf9105d Call unicode API on Windows (Chun Kuan Lee)

Pull request description:

  Call Unicode API on Windows

Tree-SHA512: 93c290ee79c9d911fdada8ba45e184fc4f14d3cb56f33f39223286213878b08e8c4dd296a80099c57797d3b8589870e6cff622b22e76123d7452659d49dd8309
2018-09-13 12:11:44 +02:00
Wladimir J. van der Laan 477f258755
Merge #14207: doc: -help-debug implies -help
d0b1cee1fe doc: `-help-debug` implies `-help` (Wladimir J. van der Laan)

Pull request description:

  I don't understand why `-help-debug` would be useful without requesting the help, and I've made this particular mistake one time too many.

Tree-SHA512: 370eab368d672fc09e66fcc440db3cb7e4c70c2988aab506cdc3f3e234c27c8f0fc7512c9cf86606ac43f5c6023b3618b7b0302b4b6e289b388559ba8010f27a
2018-09-13 12:00:36 +02:00
Wladimir J. van der Laan 81b3f3c7a3
Merge #14195: Pass privkey export DER compression flag correctly
9a565a8282 Pass export privkey DER compression flag correctly (liuyujun)

Tree-SHA512: 3fa1d7568ce133cd22708f453f3252c1138b1c40a821e90546d83bee4aac117ac8d848fa46cb45efad1031ce03cd5ba2d6c89b459abca6703aa2a957531e7edf
2018-09-13 09:59:39 +02:00
liuyujun 9a565a8282 Pass export privkey DER compression flag correctly
By passing a bitfield where a boolean was expected, the result was
always compressed. Fix this.
2018-09-13 09:58:26 +02:00
Wladimir J. van der Laan 1bfcc0696c
Merge #14209: logging: Replace LogPrint macros with regular functions
fae3fbd61a logging: Replace LogPrint macros with regular functions (MarcoFalke)

Pull request description:

  It is not possible to run the full test suite when configured with `--enable-lcov`, since logging is disabled currently so that "unnecessary branches are not analyzed". (See c8914b9dbb)

  Fix this instead by replacing the macros with functions.

Tree-SHA512: 101aa4f4a3ffcefc38faf70c9d3deb5fc63e0b11ca54a164d0463931c79eaf53ab0b0c6ae92a45355574e3b1d2c32233874a6b24293e7a09d188fc6698e212a5
2018-09-13 09:45:22 +02:00
Wladimir J. van der Laan d0b1cee1fe doc: -help-debug implies -help
I don't understand why `-help-debug` would be useful without requesting
the help, and I've made this particular mistake one time too many.

(ok, so apparently the original reason that -help-debug is an option is
to show debug options in the GUI option overview? that seems very
unlikely to ever be used, if someone wants to add a way to show debug
options in the GUI it'd be better to have a check box)
2018-09-13 07:57:13 +02:00
Pierre Rochard 2d471636eb wallet: Remove trailing separators from -walletdir arg 2018-09-12 21:05:53 -04:00
Pierre Rochard ea3009ee94 wallet: Add walletdir arg unit tests 2018-09-12 21:05:53 -04:00
MarcoFalke fae3fbd61a
logging: Replace LogPrint macros with regular functions 2018-09-12 11:28:01 -04:00
Wladimir J. van der Laan 8f464549c4
Merge #14204: build: Move interfaces/* to libbitcoin_server
e0664f7f54 build: Move interfaces/* to libbitcoin_server (Wladimir J. van der Laan)

Pull request description:

  Move interfaces/* from libbitcoin_util to libbitcoin_server.

  Usage of these is shared between `bitcoind` and `bitcoin-qt`. It is unnecessary for them to be linked against the other utilities. Also semantically they belong with the server/node, I think.

Tree-SHA512: f82f3a95d362051c0eb8092520715f77c2c75409d41f9c0fab9a15445ea9e79a2a36b5d00b1f5be09b266584051934a32a8b9b28f783f4d7be78885b4a29a383
2018-09-12 17:11:17 +02:00
Wladimir J. van der Laan 1c12cf6073
Merge #13886: utils: run commands using utf-8 string on Windows
23db9546c1 utils: run commands using utf-8 string on Windows (Chun Kuan Lee)

Pull request description:

  Use unicode string to call commans

Tree-SHA512: 72f84e7b56cd947ad05176f10b5ddd5610f4641ba5e93ffd67777dea8f9734ec06e6ed3a63f67ae5e766767122c0dd2c441d0bad5572bdb9fb78758f02531feb
2018-09-12 11:21:04 +02:00
Wladimir J. van der Laan e0664f7f54 build: Move interfaces/* to libbitcoin_server
These are shared between bitcoind and bitcoin-qt. It is unnecessary for
them to be linked against the other utilities.
2018-09-12 09:35:41 +02:00
mruddy f1bd03eb01 [depends, zmq, doc] upgrade zeromq to 4.2.5 and avoid deprecated zeromq api functions 2018-09-11 16:33:05 -04:00
MarcoFalke fa511e8dad
Pass tx pool reference into CheckSequenceLocks 2018-09-11 12:08:17 -04:00
MarcoFalke 4103cc3169
Merge #14168: Remove ENABLE_WALLET from libbitcoin_server.a
7d038dcb41 [build] remove ENABLE_WALLET ifdef from httprpc.cpp (John Newbery)
3076556cd0 [build] Move dummy wallet into its own .cpp file. (John Newbery)

Pull request description:

  This removes the final instances of ENABLE_WALLET in libbitcoin_server and so completes #7965.

Tree-SHA512: a49128b7c17f4f69940d5843e6b785f08687efb377b5157d5b267d1205e596eb5c1966f1afb8ab36bcc2491c46252099e3e844c91f5623da8ded2e358d46338d
2018-09-11 09:46:42 -04:00
Chun Kuan Lee d38bf9105d Call unicode API on Windows 2018-09-11 21:09:46 +08:00
Wladimir J. van der Laan 362518791a
Merge #13734: gui: Drop boost::scoped_array and use wchar_t API explicitly on Windows
bb6ca65f98 gui: get special folder in unicode (Chun Kuan Lee)
1c5d225853 Drop boost::scoped_array (Chun Kuan Lee)

Pull request description:

  Drop boost::scoped_array and simplify the code.

  `TCHAR` should be defined as `wchar_t` if `UNICODE` is defined. So we can use `.toStdWString().c_str()` to get wchar_t C-style string.

  Fix #13819

Tree-SHA512: 3fd4aa784129c9d1576b01e6ee27faa42d793e152d132f2dde504d917dad3a8e95e065fcbc54a3895d74fb6b2a9ed4f5ec67d893395552f585e225486a84a454
2018-09-11 10:58:10 +02:00
Wladimir J. van der Laan e3fec3cfa8
Merge #13419: [tests] Speed up knapsack_solver_test by not recreating wallet 100 times.
a679109be4 Speed up knapsack_solver_test by not recreating wallet 100 times. (lucash.dev@gmail.com)

Pull request description:

  Optimization of `knapsack_solver_test`by moving an expensive wallet creation to outside a 100x for loop.

  On my (slow) machine:

  ```
  before:        9.8s
  after:         6.2s
  --------------------
  saved:         3.6s (36%)
  ```

  This PR was split from #13050. Also see #10026.

Tree-SHA512: bde1a856b5f076a5845e14d1a924855c8c91742c3139b47903081289b21d01fef6f2d1fd8947058728a57de56f877bab3866af8cd1d25ba2daa44411752cdb2f
2018-09-11 10:22:36 +02:00
Wladimir J. van der Laan bcffd8743e
Merge #13558: Drop unused GetType() from CSizeComputer
893628be01 Drop minor GetSerializeSize template (Ben Woosley)
da74db0940 Drop unused GetType() from CSizeComputer (Ben Woosley)

Pull request description:

  Based on conversation in #13462, it seems the serialization `GetType` has very narrow use/effect. In every case except for `CAddress`, which specifically relates to a network peer's address, not a wallet address etc., the serialized representation of an object is irrespective of its destination / type.

  This removes the unused `GetType` method from `CSizeComputer` as a step to further narrowing that use.

Tree-SHA512: e72b8e9e5160396691e05aeaee3aba5a57935a75bd5005cfcc7fb51c936f3d1728a397f999da5c36696506dd815fafa5c738f3894df8864f25f91f639eba9c3d
2018-09-11 09:29:38 +02:00
Wladimir J. van der Laan 3783b139e9
Merge #13866: utils: Use _wfopen and _wfreopen on Windows
b9babc82dd utils: Use _wfopen and _wreopen on Windows (Chun Kuan Lee)

Pull request description:

  The fopen function does not support unicode filename on Windows, so use Windows specific function do deal with it.

Tree-SHA512: 4dcf14dcf9ec6307b9fdf95404e5b6b6b3df640949fd4b0c4ac7fecf8ea03a64fa25285fc319c4ff8a28e586eee106f1861116c181694955497402b2bf575f22
2018-09-11 09:02:26 +02:00
Wladimir J. van der Laan 7ab2837b65
Merge #14162: gui: Also log and print messages or questions like bitcoind
fa7e9694e1 qt: Also log and print messages or questions like bitcoind (MarcoFalke)
dd031e3839 noui: Move handlers to header file (MarcoFalke)

Pull request description:

  Testing and debugging after shutdown are harder if the node was run through the gui, because errors and warnings would not be logged to the debug.log or written to the stderr (as is the case for bitcoind).

Tree-SHA512: 1154e2bf02e3c2616c8d28609569d6c3c7344c5877ad5c1303245044cc7aced9eaec9627f1e1258ed087b49c2a2e6f99bc6c1ad0abe0a855b61e737bdf2059bc
2018-09-11 08:41:39 +02:00
Ben Woosley 893628be01
Drop minor GetSerializeSize template
Now that `GetType()` is not propagated, the benefits are not worth the code.
2018-09-11 00:58:13 -04:00
Ben Woosley da74db0940
Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
Chun Kuan Lee e221368932 utils: Convert fs error messages from multibyte to utf-8 2018-09-11 03:11:39 +08:00
John Newbery 7d038dcb41 [build] remove ENABLE_WALLET ifdef from httprpc.cpp 2018-09-10 14:27:32 -04:00
Wladimir J. van der Laan 13c842e028
Merge #9332: Let wallet importmulti RPC accept labels for standard scriptPubKeys
98ea64cf23 Let wallet importmulti RPC accept labels for standard scriptPubKeys (Russell Yanofsky)

Pull request description:

  Allow importmulti RPC to apply address labels when importing standard scriptPubKeys. This makes the importmulti RPC less finnicky about import formats and also simpler internally.

Tree-SHA512: 102426b21239f1fa5f38162dc3f4145572caef76e63906afd786b7aff1670d6cd93456f8d85f737588eedc49c11bef2e1e8019b8b2cbf6097c77b3501b0cab1f
2018-09-10 19:02:44 +02:00
Wladimir J. van der Laan e0a4f9de7f
Merge #13793: tx pool: Use class methods to hide raw map iterator impl details
faa1a74942 tx pool: Use class methods to hide raw map iterator impl details (MarcoFalke)

Pull request description:

  ATMP et al would often use map iterator implementation details such as `end()` or `find()`, which is acceptable in current code.

  However, this not only makes it impossible to turn the maps into private members in the future but also makes it harder to replace the maps with different data structures.

  This is required for and split off of #13804

Tree-SHA512: 4f9017fd1d98d9df49d25bba92655a4a97755eea161fd1cbb565ceb81bbc2b4924129d214f8a29563a77e3d8eef85a67c81245ecdc9a9e5292d419922a93cb88
2018-09-10 18:32:00 +02:00
Wladimir J. van der Laan 838b85e120
Merge #14008: Preserve a format of RPC command definitions
d9d79576f4 Preserve a format of RPC command definitions (Kostiantyn Stepaniuk)

Pull request description:

  Currently, RPC commands are formatted in a way that it's easy to read
  and that `test/lint/check-rpc-mappings.py` can parse it.

  To void breaking `test/lint/check-rpc-mappings.py` script by running
  `clang-format`, RPC command definitions should be disabled for clang-format.

Tree-SHA512: e17d20ec0e6c4e19410198b55687ebbe6fa01654d214d4578cd16c00b872bf8b0b306594a45523685cd2e9d9280702e00471d9366e87954428e8bbeacd8cad60
2018-09-10 18:14:05 +02:00
Wladimir J. van der Laan 7c7bb6e772
Merge #14127: build: avoid getifaddrs when unavailable
9256f7d13f build: avoid getifaddrs when unavailable (Cory Fields)

Pull request description:

  These changes from @theuni help building when targeting platforms that don't always have getifaddrs available like Android < 24

Tree-SHA512: dbfeb83297bd6f00b7991f53eef8a04948d2d739bf47c0524d9ae5335b843b8a5c06ff98c109fe5e6192665e6d0cf58700b8aa7e2a0b410281d3c052881973ff
2018-09-10 18:08:05 +02:00
Wladimir J. van der Laan 6eeac2e628
Merge #14138: wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG.
fa462b3657 wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG. (practicalswift)

Pull request description:

  Set `encrypted_batch` to `nullptr` after delete. Avoid double free in the case of `NDEBUG`.

Tree-SHA512: 6f5ab40c82dd8c8713bbf1aacacdc837277c04769807f985248546be1c7ea269813c95379fbef982ac5683a45af0225613460a7446c39673b033f5f5edde2f5a
2018-09-10 17:59:15 +02:00
Wladimir J. van der Laan 321075609d
Merge #14054: p2p: Disable BIP 61 by default
faea5bfc5a doc: release notes for -enablebip61 default change (MarcoFalke)
fa14b54a87 p2p: Disable BIP 61 by default (MarcoFalke)

Pull request description:

  The live p2p network should not be used for debugging or as development aid when implementing the p2p protocol. Instead, applications should be tested locally (e.g. by inspecting the debug log of a validating node on the local network)

  Using the p2p network for this purpose seems wasteful and even dangerous, as peers can not be trusted to send the correct reject messages or a reject message at all.

Tree-SHA512: 9c91ad035b5110942172a3b4b8a332a84e0c0aa9ee80f8134aeab63e66ac604841e68b04038681c288b716e5e0cbe38065eb5c7eb63fa72c3bdb3255a4b2d99d
2018-09-10 17:57:47 +02:00
MarcoFalke 793d2b7430
Merge #14164: Update univalue subtree
dc287c98f8 Squashed 'src/univalue/' changes from 51d3ab34ba..7890db99d6 (MarcoFalke)

Pull request description:

  This removes the deprecated `std::pair` wrappers from univalue, so that they are not accidentally re-introduced in our code base.

Tree-SHA512: 46f6f7c7c7942a9e131d971c425cbde4159abcc1214235b61139ce97b174024e47b9c52e832cde89fbab9879f43d12c26b64d6def9907bd47883f1e574cf2e2e
2018-09-10 11:00:46 -04:00
Wladimir J. van der Laan fbfa2e46ff
Merge #14057: [Logging] Only log "Using config file PATH_TO_bitcoin.conf" message on startup if conf file exists
946107a68f Only log "Using PATH_TO_bitcoin.conf" message on startup if conf file exists. (Alexander Leishman)

Pull request description:

  Currently we log a message indicating that a bitcoin.conf file is being used even if one does not exist. This PR changes the logic to:

  **If config file does not exist and no -conf flag passed, log:**
  `Config file: FILE_PATH (not found, skipping)`. Where `FILE_PATH` is the default or the path passed in with the `-conf` flag.

  **If config file does not exist and -conf flag passed with incorrect path, log warning:**
  `Warning: The specified config file FILE_PATH does not exist`

  **If config file exists, log**:
  `Config file: FILE_PATH`

  Note: This is a (modified) subset of changes introduced in https://github.com/bitcoin/bitcoin/pull/13761 which creates a default example config file. I think it makes sense to extract this small bit out into a separate PR.

Tree-SHA512: be0f0ae6a0c9041e2d6acb54d2563bbcc79786fb2f8bf9a963fe01bc54cd4e388b89079fde1eb79f7f17099776428e5e984bf7107590a3d1ecfc0562dbc6e3f5
2018-09-10 15:39:05 +02:00
Michael Polzer bc8aa2ba78
don't translate command line options 2018-09-10 13:08:25 +02:00
João Barbosa b9f226b41f rpc: Remove cs_main lock from blockToJSON and blockHeaderToJSON 2018-09-09 18:02:24 +01:00
João Barbosa 343b98cbcd rpc: Specify chain tip instead of chain in GetDifficulty 2018-09-09 18:02:22 +01:00
João Barbosa 54dc13b6a2 rpc: Fix SoftForkMajorityDesc and SoftForkDesc signatures 2018-09-09 18:00:07 +01:00
Wladimir J. van der Laan eea87ef537
Merge #12775: Integration of property based testing into Bitcoin Core
b2f49bd732 Integration of property based testing into Bitcoin Core (Chris Stewart)

Pull request description:

  This PR is a subset of the changes in #8469. It's meant to be easier to review. This PR contains all of the build instructions needed for travis to pass. It includes one property call `key_properties.cpp` along with a generator file called `crypto_gen.{h,cpp}`.

Tree-SHA512: 895c9d9273dcd29f696b1de8dfe1ee843095831bf1f68472844181278850bec36b20f0ba7e51e796112c5cc75cd24759f9f1771906503bbf3af16f627e18c6c9
2018-09-08 05:33:16 +02:00
John Newbery 3076556cd0 [build] Move dummy wallet into its own .cpp file.
Removes the ifdef ENABLE_WALLET from init.cpp.
2018-09-07 16:08:40 -04:00
MarcoFalke fb06eb4ef7
Merge #13662: Explain when reindex-chainstate can be used instead of reindex
65a449f8e3 Explain when reindex-chainstate can be used instead of reindex (Sjors Provoost)

Pull request description:

  Save users from having to Google this: https://bitcoin.stackexchange.com/a/60711

Tree-SHA512: 3128565d037c77265a2ecf3bce137b8d27740f513802a4e683be06f21a75b82ee6cc22eb903181c4f438a2990cb682ce1d076f4d3af33d5aaa79b783a9f664b1
2018-09-07 14:21:38 -04:00
MarcoFalke faa1a74942
tx pool: Use class methods to hide raw map iterator impl details 2018-09-07 13:04:02 -04:00
MarcoFalke faad55a9a2
Update univalue subtree 2018-09-07 08:21:14 -04:00
MarcoFalke fa14b54a87
p2p: Disable BIP 61 by default 2018-09-07 08:11:27 -04:00
MarcoFalke 4799b0932a
Merge #12490: [Wallet] [RPC] Remove deprecated wallet rpc features from bitcoin_server
f7e9e70468 [rpc] Remove deprecated sigrawtransaction rpc method. (John Newbery)
90c834089a [RPC] Remove warning about wallet addresses in createmultisig() (John Newbery)
df905e390e [rpc] Remove deprecated validateaddress usage. (John Newbery)

Pull request description:

  The following rpc features were deprecated in V0.17:

  - `validateaddress` returning wallet information about an address
  - `signrawtransaction`

  This PR fully removes those features. It can be merged once V0.17 has been branched from master.

Tree-SHA512: 28293d218cf7e348632081e362f8775f243d091f49aed54c354f017d4a12ae92b87b99f81ee592a1bbf4aebd5d8cd5119278141edde7a0399ff82917ed68b9f6
2018-09-06 23:01:50 -04:00
MarcoFalke fa7e9694e1
qt: Also log and print messages or questions like bitcoind 2018-09-06 15:19:56 -04:00
MarcoFalke dd031e3839 noui: Move handlers to header file 2018-09-06 15:00:01 -04:00
Wladimir J. van der Laan 2f7ae35ce8
Merge #14149: doc: Remove misleading checkpoints comment in CMainParams
fab5267514 doxygen: Remove misleading checkpoints comment in CMainParams (MarcoFalke)

Pull request description:

  This removes the checkpoints comment because it is misleading for two reasons:

  * It shows up in the doxygen documentation of `CMainParams` https://dev.visucore.com/bitcoin/doxygen/class_c_main_params.html
  * The comment refers to "strange transactions" in a block, which are not specified further. Transactions in blocks are always consensus-valid or rejected as consensus-invalid.

  Also sort the includes with `clang-format`, as the file is touched anyway.

Tree-SHA512: b75f38dd0422b9310218307cbaa4dd5afa7579612d7dcdf781b8f25626f79c11e090dbcc83a05571f4418220c1a005f6254a9c461534d517ccecf7f1920be6be
2018-09-06 15:55:13 +02:00
Wladimir J. van der Laan 35d7d9471f
Merge #14096: Add reference documentation for descriptors language
2b5d6f8df2 Replace duplcate reference with reference to reference doc (Pieter Wuille)
89709db7a2 Adjust TODO link (Pieter Wuille)
9254ffcf2d Add descriptor reference documentation (Pieter Wuille)

Pull request description:

Tree-SHA512: 1ca0d537f9bcbb23266e9a4a02a60013ef8309958fb701f638283887585b5ddea6bc9dab859454ec3a373b1a12a4fd69836e7030417bb2ca43fef26b104c0d65
2018-09-06 14:51:07 +02:00
Wladimir J. van der Laan a6aca8dc2f
Merge #14105: util: Report parse errors in configuration file
ed2332aeff test: Add test for config file parsing errors (MarcoFalke)
a66c0f78a9 util: Report parse errors in configuration file (Wladimir J. van der Laan)

Pull request description:

  Report errors while parsing the configuration file, instead of silently ignoring them.

      $ src/bitcoind -regtest
      Error reading configuration file: parse error on line 22: nodebuglogfile, if you intended to specify a negated option, use nodebuglogfile=1 instead
      $ src/bitcoind -regtest
      Error reading configuration file: parse error on line 22: sdafsdfafs
      $ src/bitcoind -regtest
      Error reading configuration file: parse error on line 24: -nodebuglogfile=1, options in the configuration file must be specified without leading -

  (inspired by https://github.com/bitcoin/bitcoin/pull/14100#issuecomment-417264823)

Tree-SHA512: d516342b65db2969edf200390994bbbda23654c648f85dcc99f9f2d217d3d59a72e0f58227be7b4746529dcfa54ba26d8188ba9f14a57c9ab00015d7283fade2
2018-09-06 12:56:10 +02:00
MarcoFalke adf27b531a
Merge #13954: Warn (don't fail!) on spelling errors. Fix typos reported by codespell.
f8a81f73ac lint: Add spell check linter (codespell) (practicalswift)
ada356208e Fix typos reported by codespell (practicalswift)

Pull request description:

  * Check for common misspellings using `codespell`.
  * Fix recently introduced typos reported by `codespell`.

Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
2018-09-05 18:13:05 -04:00
Pieter Wuille 2b5d6f8df2 Replace duplcate reference with reference to reference doc 2018-09-05 11:27:43 -07:00
Pieter Wuille 89709db7a2 Adjust TODO link 2018-09-05 11:26:16 -07:00
Wladimir J. van der Laan e9a78e9b3b doc: Change documentation for =0 for non-boolean options
PR #12713 changed the interpretation for negation of non-boolean options
(e.g. -noconnect) to no longer set the option to 0, but to remove it
from the options.

I think this is better because it gets rid of the special meaning of
'0'.

However it needs to be documented. I attempt to do so in this PR.
Addreses #14064.
2018-09-05 14:18:23 +02:00
MarcoFalke fab5267514
doxygen: Remove misleading checkpoints comment in CMainParams 2018-09-04 13:42:42 -04:00
Wladimir J. van der Laan 5c24d3b98c
Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
f34c8c466a Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift)

Pull request description:

  Make objects in range declarations immutable by default.

  Rationale:
  * Immutable objects are easier to reason about.
  * Prevents accidental or hard-to-notice change of value.

Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
2018-09-04 15:50:08 +02:00
Wladimir J. van der Laan bdfeb5dfa8
Merge #14133: gui: Favor macOS show / hide action in dock menu
ee3a494f37 gui: Favor macOS show / hide action in dock menu (João Barbosa)

Pull request description:

  Before:

  <img width="188" alt="screen shot 2018-09-02 at 19 10 02" src="https://user-images.githubusercontent.com/3534524/44959393-5a44c400-aee5-11e8-90f4-9a30f67f7ee2.png">

  After:

  <img width="200" alt="screen shot 2018-09-02 at 19 19 01" src="https://user-images.githubusercontent.com/3534524/44959395-60d33b80-aee5-11e8-9773-1d04d3482115.png">

  Note that macOS toggles between `Hide` and `Show`.

Tree-SHA512: e616fabc5a4689355d924cb99ce33c0d4c6618e858002cef7521dc4783346ff882341cf8d7f667d7fb920a8337373eff37169cddc2da93e48f7710e5c41d0b93
2018-09-04 14:07:45 +02:00
practicalswift ada356208e Fix typos reported by codespell 2018-09-04 13:11:26 +02:00
Wladimir J. van der Laan 0f34dac67b
Merge #14013: [doc] Add new regtest ports in man following #10825 ports reattributions
e8c4a1e369 Add new regtest ports in doc following #10825 ports reattributions (Antoine Riard)

Pull request description:

  Following #10825, regtest ports for p2p connections and JSON-RPC connections have been remapped from 18333 and 18332 to 18444 and 18443. This change is not documented in the wiki or nowhere else and it's puzzling to guess why your regtest JSON-rpc connections all failed even if you're following the docs.

Tree-SHA512: e2a1b9b4059060d9ed0900c1554e124ed69ae3e4648474880795128e77c7324d68aba52e4acda2f47390a9c3d36629b777e3b8c0eb10f0e08a2b120c4119dff3
2018-09-04 12:51:06 +02:00
Wladimir J. van der Laan 564385f4bf
Merge #14094: refactoring: Remove unreferenced local variables
8ecaee13f7 Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4 (12 is assuming the changes in #14086 are also implemented). (practicalswift)

Pull request description:

  Remove unreferenced local variables:

  Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4. 12 is the number of MSVC warnings under our current appveyor setup assuming the changes in #14086 are also implemented.

  This makes it easier to spot errors or more important warnings in the verbose appveyor output. MSVC warnings are good, so having access to them in a noise free way (read: without trivial warnings) via appveyor without having to use Windows is really valuable.

  See https://github.com/bitcoin/bitcoin/pull/14086#issuecomment-416610313 plus discussion for context.

  Before:

  ```
  c:\projects\bitcoin\src\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch [C:\projects\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj]
  c:\projects\bitcoin\src\rest.cpp(467): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\libbitcoin_server\libbitcoin_server.vcxproj]
  c:\projects\bitcoin\src\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(511): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(524): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(722): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(783): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\dbwrapper_tests.cpp(265): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\net_tests.cpp(118): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\net_tests.cpp(151): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\scheduler_tests.cpp(57): warning C4305: 'argument': truncation from 'int' to 'bool' [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  ```

  After:

  ```
  c:\projects\bitcoin\src\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch [C:\projects\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj]
  c:\projects\bitcoin\src\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\scheduler_tests.cpp(57): warning C4305: 'argument': truncation from 'int' to 'bool' [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  ```

Tree-SHA512: 5051134126c570b8421d57c710f1f1b977600398d2b5e69f8a8bd766b3696f992bf4e3459643b99a6b7e08dee1adc92985ee4d0d52b20755954415cb6f23f2fb
2018-09-04 12:44:49 +02:00
Wladimir J. van der Laan 281feee7cc
Merge #14129: Trivial: update clang thread-safety docs url
c7f7fa467e Trivial: update clang thread-safety docs url (Ben Woosley)

Pull request description:

  From the defunct http://clang.llvm.org/docs/LanguageExtensions.html#threadsafety to https://clang.llvm.org/docs/ThreadSafetyAnalysis.html

Tree-SHA512: 5113c3933fccee7b45cace5d8dffa38b46ed9ad1422795d57843a20b276ed0e513bbf8d3d2bd28f55a46baf14a349871d7a635485785b93cb21baf8b8720c15a
2018-09-04 12:30:33 +02:00
Wladimir J. van der Laan 788b8a290c
Merge #14135: doc: correct GetDifficulty doc after #13288
68bfc0bce3 doc: correct GetDifficulty doc after #13288 (fanquake)

Pull request description:

  `chain` is no longer passed to GetDifficulty, and we just return `1.0` if no `blockindex`.

Tree-SHA512: 701375d732f343200c4abfaf9039d5c12b10abff97b022e84564f81b26b5ba552f1eb0c0d0fd5370b29b53319eafcf39773a36e1c2dd04ee77e61c18c7b183fa
2018-09-04 12:28:50 +02:00
Sjors Provoost 66e15e8f97
Explain GetAncestor check for m_failed_blocks in AcceptBlockHeader 2018-09-04 10:50:19 +02:00
practicalswift 8ecaee13f7 Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4 (12 is assuming the changes in #14086 are also implemented).
This makes it easier to spot errors or more important warnings in the verbose appveyor output.

See https://github.com/bitcoin/bitcoin/pull/14086#issuecomment-416610313 plus discussion for context.
2018-09-03 19:53:56 +02:00
practicalswift fa462b3657 wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG. 2018-09-03 15:41:02 +02:00
fanquake 68bfc0bce3
doc: correct GetDifficulty doc after #13288 2018-09-03 09:35:41 +08:00
João Barbosa ee3a494f37 gui: Favor macOS show / hide action in dock menu 2018-09-02 19:09:36 +01:00
Ben Woosley c7f7fa467e
Trivial: update clang thread-safety docs url 2018-09-02 02:49:30 -04:00
Cory Fields 9256f7d13f
build: avoid getifaddrs when unavailable 2018-09-01 15:25:03 +02:00
Patrick Strateman 83d53058ae Switch nPrevNodeCount to vNodesSize.
These both have the same value, but the variable naming is confusing.
2018-08-31 18:32:11 -04:00
Russell Yanofsky 190bf62be1 scripted-diff: Small locking rename
Call sync.h primitives "locks" and "mutexes" instead of "blocks" and "waitable
critical sections" to match current coding conventions and c++11 standard
names.

This PR does not rename the "CCriticalSection" class (though this could be done
as a followup) because it is used everywhere and would swamp the other changes
in this PR. Plain mutexes should mostly be preferred instead of recursive
mutexes in new code anyway.

-BEGIN VERIFY SCRIPT-
set -x
set -e
ren() { git grep -l $1 | xargs sed -i s/$1/$2/; }
ren CCriticalBlock           UniqueLock
ren CWaitableCriticalSection Mutex
ren CConditionVariable       std::condition_variable
ren cs_GenesisWait           g_genesis_wait_mutex
ren condvar_GenesisWait      g_genesis_wait_cv
perl -0777 -pi -e 's/.*typedef.*condition_variable.*\n\n?//g' src/sync.h
-END VERIFY SCRIPT-
2018-08-31 10:00:38 -04:00
Wladimir J. van der Laan 385ad11040
Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection
9c4dc597dd Use LOCK macros for non-recursive locks (Russell Yanofsky)
1382913e61 Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection (Russell Yanofsky)
ba1f095aad MOVEONLY Move AnnotatedMixin declaration (Russell Yanofsky)
41b88e9337 Add unit test for DEBUG_LOCKORDER code (Russell Yanofsky)

Pull request description:

  Make LOCK macros work with non-recursive mutexes, and use wherever possible for better deadlock detection.

  Also add unit test for DEBUG_LOCKORDER code.

Tree-SHA512: 64ef209307f28ecd0813a283f15c6406138c6ffe7f6cbbd084161044db60e2c099a7d0d2edcd1c5e7770a115e9b931b486e86c9a777bdc96d2e8a9f4dc192942
2018-08-31 16:00:38 +02:00
MarcoFalke b012bbe358
Merge #10605: Add AssertLockHeld assertions in CWallet::ListCoins
62b6f0f21e Add EXCLUSIVE_LOCKS_REQUIRED to CWallet::ListCoins (Russell Yanofsky)
545e85eccc Add AssertLockHeld assertions in CWallet::ListCoins (Russell Yanofsky)

Pull request description:

  Fixes TODO from #10295

Tree-SHA512: 2dd03a8217e5e1313aa2119cb530e0c0daf3ae3a751b6fdec611df57b8090201a90b52ff05f8f696e978a1344aaf21989d67a03beb5ef6ef79b77be38d04b451
2018-08-31 09:03:05 -04:00
Chun Kuan Lee b9babc82dd utils: Use _wfopen and _wreopen on Windows
The fopen function does not support unicode filename on Windows, so use Windows specific function do deal with it
2018-08-31 21:02:53 +08:00
Wladimir J. van der Laan 709a15b0a6
Merge #14088: tests: Don't assert(...) with side effects
ca1a093127 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3869 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in #14069 which was merged two days ago) and since this is a recurring thing (see #13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
2018-08-31 15:00:15 +02:00
MarcoFalke bdbd654df8
Merge #14108: tests: Add missing locking annotations and locks (g_cs_orphans)
b602c9b3af tests: Add missing locking annotations and locks (practicalswift)

Pull request description:

  Add missing locking annotations and locks.

  `mapOrphanTransactions` is guarded by `g_cs_orphans`.

Tree-SHA512: f95104fbef23bd385e754c6bea3c3bdddd8a9c6a68e719d761227c9be1e46ff1316ec050a15a1243218dbab4e8584da6674f4a72f949f54b0a758392f19c83f8
2018-08-31 08:32:31 -04:00
Russell Yanofsky 62b6f0f21e Add EXCLUSIVE_LOCKS_REQUIRED to CWallet::ListCoins
Suggested by MarcoFalke <falke.marco@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/10605#issuecomment-417643535
2018-08-31 08:11:01 -04:00
Wladimir J. van der Laan 3f96908448
Merge #14073: blockfilter: Avoid out-of-bounds script access.
f05599557a blockfilter: Omit empty scripts from filter contents. (Jim Posen)

Pull request description:

  Caught during review of #12254 by @TheBlueMatt. https://github.com/bitcoin/bitcoin/pull/12254#discussion_r212830981

Tree-SHA512: cfc9e3eeaba12a14fd3d2e1ccce1a1f89e8cf44cc340ceec05d2d5fa61d27ff64e355603f4ad2184ff73c0ed23dfdab6e2103bddc48f3b76cb13b88d428770ac
2018-08-31 13:35:31 +02:00
Wladimir J. van der Laan bb0277819a
Merge #13159: Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP)
75ea00f391 Remove unused fsbridge::freopen (practicalswift)
cceedbc4bf Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP) (practicalswift)

Pull request description:

  Don't close old debug log file handle prematurely when trying to re-open (on `SIGHUP`).

  Context: https://github.com/bitcoin/bitcoin/pull/13148#issuecomment-386288606

  Thanks @ajtowns!

Tree-SHA512: c436b4286f00fc428b60269b6d6321f435c72c7ccec3c15b2194aac71196529b30f32c2384b418ffe3ed67ba7ee8ec51f4c9c5748e65945697c0437eafcdacd1
2018-08-31 13:19:12 +02:00
practicalswift dfef0df840 tests: Dry run bench_bitcoin (-evals=1 -scaling=0: <1 second running time) as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code 2018-08-30 22:54:42 +02:00
Alexander Leishman 946107a68f Only log "Using PATH_TO_bitcoin.conf" message on startup if conf file exists.
Currently we log a message indicating that a bitcoin.conf file is being used
even if one does not exists. This commit changes the logic to only display
this message if a config file exists and logs a separate message
if no config file exists. Additionally, a warning is now logged if the file
path passed in the -conf flag does not exist.
2018-08-30 11:24:03 -07:00
practicalswift b602c9b3af tests: Add missing locking annotations and locks 2018-08-30 16:36:26 +02:00
Wladimir J. van der Laan 07033a8f91
Merge #13825: [wallet] Kill accounts
c9c32e6b84 [wallet] Kill accounts (John Newbery)

Tree-SHA512: 783272e7df9042fb0a01826fa37a02b97218496459015d7457e56223da8690bdad930c223dd4a903a1d4df57f3f2f4a097d392d272a72419ea9a882b11e599f7
2018-08-30 16:18:36 +02:00
John Newbery c9c32e6b84 [wallet] Kill accounts
This commit does the following changes:

- [wallet] Remove 'account' argument from GetLegacyBalance()
  - GetLegacyBalance() is never called with an account argument.
    Remove the argument and helper functions.
- [wallet] Remove CWallet::ListAccountCreditDebit()
  - Function no longer used.
- [wallet] Remove AccountMove()
  - Function no longer used.
- [wallet] Remove AddAccountingEntry()
  - Function no longer used.
- [wallet] Remove GetAccountCreditDebit()
  - Function no longer used.
- [wallet] Don't rewrite accounting entries when reordering wallet transactions.
 - Accounting entries are deprecated. Don't rewrite them to the wallet
   database when re-ordering transactions.
- [wallet] Remove WriteAccountingEntry()
  - Function no longer used.
- [wallet] Don't read acentry key-values from wallet on load.
- [wallet] Remove ListAccountCreditDebit()
  - Function no longer used.
- [wallet] Remove CAccountingEntry class
  - No longer used
- [wallet] Remove GetLabelDestination
  - Function no longer used.
- [wallet] Delete unused account functions
  - ReadAccount
  - WriteAccount
  - EraseAccount
  - DeleteLabel
- [wallet] Remove fromAccount argument from CommitTransaction()
- [wallet] Remove strFromAccount.
  - No longer used.
- [wallet] Remove strSentAccount from GetAmounts().
  - No longer used.
- [wallet] Update zapwallettxes comment to remove accounts.
- [wallet] Remove CAccount
  - No longer used
- [docs] fix typo in release notes for PR 14023
2018-08-30 16:08:42 +02:00
Wladimir J. van der Laan a66c0f78a9 util: Report parse errors in configuration file
Report errors while parsing the configuration file, instead of silently
ignoring them.

    $ src/bitcoind -regtest
    Error reading configuration file: parse error on line 22: nodebuglogfile, if you intended to specify a negated option, use nodebuglogfile=1 instead
    $ src/bitcoind -regtest
    Error reading configuration file: parse error on line 22: sdafsdfafs
    $ src/bitcoind -regtest
    Error reading configuration file: parse error on line 24: -nodebuglogfile=1, options in the configuration file must be specified without leading -
2018-08-30 14:41:33 +02:00
MarcoFalke 6c7cfc8da6
Merge #13126: util: Add Clang thread safety annotations for variables guarded by cs_args
1e29379d69 Fix potential deadlock (practicalswift)
d58dc9f943 Add lock annotations (cs_args) (practicalswift)
db5e9d3c88 Add missing locks (cs_args) (practicalswift)

Pull request description:

  * Add missing `cs_args` locks
  * Add Clang thread safety annotations for variables guarded by `cs_args`

Tree-SHA512: bc562dbddf24a287bcf9bf902bc930f942f260a94e5c8ec4d190f7f2ddac448ed3d52acadaf9fc1c81a5cbff2c171c52c18ba0804eeb03f699d70394e1c977c5
2018-08-30 07:52:55 -04:00
Wladimir J. van der Laan be301a5777
Merge #14103: docs: Fix broken Doxygen comments
0e534d4dca Fix incorrect Doxygen comments (practicalswift)

Pull request description:

  Fix broken Doxygen comments.

  This commit was taken from #13914 which now only covers `-Wdocumentation`.

Tree-SHA512: dddbca16bb792b8193e5f417151b5eace9acc942a321f1bc095b906e98889e3bd93509fe112ab6a24ee1f6a3a918db905bda7acefd53774fe3e6ebe669fb51ac
2018-08-30 12:00:28 +02:00
practicalswift 1e29379d69 Fix potential deadlock 2018-08-30 10:02:49 +02:00
practicalswift d58dc9f943 Add lock annotations (cs_args) 2018-08-29 22:33:33 +02:00
practicalswift db5e9d3c88 Add missing locks (cs_args) 2018-08-29 20:57:41 +02:00
Wladimir J. van der Laan 4e9a6f87b7
Merge #14097: validation: Log FormatStateMessage on ConnectBlock error in ConnectTip
fa309dc305 validation: Log FormatStateMessage on ConnectBlock error in ConnectTip (MarcoFalke)

Pull request description:

  This change additionally logs the validation state on error, which is not logged at all on current master.

  Before:
  ```
  ERROR: ConnectTip(): ConnectBlock ffffff.... failed
  ```

  After:
  ```
  ERROR: ConnectTip: ConnectBlock ffffff.... failed, bad-cb-amount (code 16)
  ```

Tree-SHA512: e69ee0266772b3f77c0193c4a959c2444bf1a51259bd29d790cf665582b037997e520c8567f70b36362c071dcfe1a8ebd7c0f2286cf1b842df5731960e7e1ba0
2018-08-29 17:14:50 +02:00
Wladimir J. van der Laan 888acefa5e
Merge #13792: tx pool: Avoid passing redundant hash into addUnchecked (scripted-diff)
fa587773e5 scripted-diff: Remove unused first argument to addUnchecked (MarcoFalke)
fe5c49766c tx pool: Use the entry's hash instead of the one passed to addUnchecked (MarcoFalke)
ddd395f968 Mark CTxMemPoolEntry members that should not be modified const (MarcoFalke)

Pull request description:

  Several years ago the transaction hash was not cached. For optimization the hash was instead passed into `addUnchecked` to avoid re-calculating it. See f77654a0e9

  Passing in the hash is now redundant and the argument can safely be removed.

Tree-SHA512: 0206b65c7a014295f67574120e8c5397bf1b1bd70c918ae1360ab093676f7f89a6f084fd2c7000a141baebfe63fe6f515559e38c4ac71810ba64f949f9c0467f
2018-08-29 16:30:58 +02:00
practicalswift 75ea00f391 Remove unused fsbridge::freopen 2018-08-29 16:05:51 +02:00
practicalswift cceedbc4bf Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP) 2018-08-29 16:05:00 +02:00
Wladimir J. van der Laan b0eb8f7ed4
Merge #14028: Explicitly initialize prevector _union
1d9aa008d6 Explicitly initialize prevector _union (Ben Woosley)

Pull request description:

Tree-SHA512: 3037a5d63b840a4cb0c3c26593ce1b7e1a6ba273a4ee5072563b20169be9783dbdfe3a38c9651d73b2d18ed9668deaf65f994eca7f225c70f875716f05eda3a6
2018-08-29 15:13:45 +02:00
Wladimir J. van der Laan 5924dadc2f
Merge #13671: Remove the boost/algorithm/string/case_conv.hpp dependency
b193d5a443 Removes the Boost case_conv.hpp dependency. (251)
7a208d9fad Implements custom tolower and toupper functions. (251)
e2ba043b8d Implements ParseNetwork unit test. (251)

Pull request description:

  This pull request removes the `boost/algorithm/string/case_conv.hpp` dependency from the project.

  `boost/algorithm/string/case_conv.hpp` is included for the `boost::to_lower` and `boost::to_upper` template functions.

  We can replace the calls to these functions with straightforward alternative implementations that use the C++ Standard Library, because the functions are called with `std::string` objects that use standard 7-bit ASCII characters as argument.

  The refactored implementation should work without the explicit `static_cast<unsigned char>` cast and `unsigned char` lambda return type. Both have been added defensively and to be explicit. Especially in case of the former, behaviour is undefined (potentially result in a crash) if the `std::toupper` argument is not an `unsigned char`.

  A potential alternative, maybe even preferred, implementation to address the `boost::to_lower` function call in `ParseNetwork(std::string)` could have been:

  ```c++
  if (net == "ipv4" || net == "IPv4") return NET_IPV4;
  if (net == "ipv6" || net == "IPv6") return NET_IPV6;
  ```
  This alternative implementation would however change the external behaviour of `ParseNetwork(std::string)`.

  This pull requests includes a unit test to validate the implementation of `ParseNetwork(std::string)`  prior and after the removal of the `case_conv.hpp` dependency.

  `boost/algorithm/string/case_conv.hpp` has been removed from the `EXPECTED_BOOST_INCLUDES` in `test/lint/lint-includes.sh` because it is no longer required.

Tree-SHA512: d803ae709f2368a3efb223097384a722436955bce0c44a1a5cffd0abb3164be0cce85ba0e9ebd9408166df3f1a95ea0c0d29e3a2534af2fae206c0419d67fde9
2018-08-29 14:59:49 +02:00
Wladimir J. van der Laan 2ddce35abc
Merge #13862: utils: drop boost::interprocess::file_lock
1661a472b8 add unicode compatible file_lock for Windows (Chun Kuan Lee)

Pull request description:

  boost::interprocess::file_lock cannot open the files that contain characters which cannot be parsed by the user's code page on Windows.

  This PR is seperated from #13426 for easier review.

Tree-SHA512: e240479cda65958bf6e1319840b83928b2b50da81d99f4f002fb3b62621370bcd4bcfacd2b8c0678c443a650d6ba53d9d12618b591e5bfd67ac14388a18fd822
2018-08-29 14:16:13 +02:00
MarcoFalke 13887f41f2
Merge #14093: tests: Fix accidental trunction from int to bool
1cc58978b7 tests: Fix accidental trunction from int to bool (practicalswift)

Pull request description:

  Fix accidental trunction from `int` to `bool`.

  Context: https://github.com/bitcoin/bitcoin/pull/14086#issuecomment-416610313

Tree-SHA512: 72d209f892e580afa9c295174c206ea5ba764ff9e03613cd9bc57fd0d7118e895ee44d96db90930a29c0b4de7f51dc00101a1b32ba6b46576d34e089ff5482ba
2018-08-28 22:15:49 -04:00
MarcoFalke fa309dc305
validation: Log FormatStateMessage on ConnectBlock error in ConnectTip 2018-08-28 21:49:23 -04:00
Wladimir J. van der Laan 5de338ec72
Merge #14055: fix walletcreatefundedpsbt deriv paths, add test
61fe653bd9 fix walletcreatefundedpsbt deriv paths, add test (Gregory Sanders)

Pull request description:

  Added the regression in #13968

Tree-SHA512: a31290b57ed80a8486925e562ca5412500d4215a238de7e448f48edfa671c87aebd79ee179a8340b289d9811ae6fa30ef75eefd5f5890fb6285174c5db72ff65
2018-08-28 23:11:15 +02:00
Jim Posen f05599557a blockfilter: Omit empty scripts from filter contents.
Code change also avoids out-of-bounds script access bug.
2018-08-28 12:12:32 -07:00
251 b193d5a443 Removes the Boost case_conv.hpp dependency.
This commit removes the `boost/algorithm/string/case_conv.hpp` dependency from the project. It replaces the `boost::to_lower` and `boost::to_upper` functions with custom functions that are locale independent and ASCII deterministic.
2018-08-28 18:42:53 +02:00
251 7a208d9fad Implements custom tolower and toupper functions.
This commit implements custom equivalents for the C and C++ `tolower` and `toupper` Standard Library functions.
In addition it implements a utility function to capitalize the first letter of a string.
2018-08-28 18:42:27 +02:00
251 e2ba043b8d Implements ParseNetwork unit test.
This commit implements a unit test that validates the `ParseNetwork(std::string)` implementation in `netbase.cpp`.
2018-08-28 18:37:34 +02:00
practicalswift 1cc58978b7 tests: Fix accidental trunction from int to bool 2018-08-28 17:42:55 +02:00
Wladimir J. van der Laan aa39ca7645
Merge #13723: PSBT key path cleanups
917353c8b0 Make SignPSBTInput operate on a private SignatureData object (Pieter Wuille)
cad5dd2368 Pass HD path data through SignatureData (Pieter Wuille)
03a99586a3 Implement key origin lookup in CWallet (Pieter Wuille)
3b01efa0d1 [MOVEONLY] Move ParseHDKeypath to utilstrencodings (Pieter Wuille)
81e1dd5ce1 Generalize PublicOnlySigningProvider into HidingSigningProvider (Pieter Wuille)
84f1f1bfdf Make SigningProvider expose key origin information (Pieter Wuille)
611ab307fb Introduce KeyOriginInfo for fingerprint + path (Pieter Wuille)

Pull request description:

  This PR adds "key origin" (master fingeprint + key path) information to what is exposed from `SigningProvider`s, allowing this information to be used by the generic PSBT code instead of having the RPC pull it directly from the wallet.

  This is also a preparation to having PSBT interact with output descriptors, which can then directly expose key origin information for the scripts they generate.

Tree-SHA512: c718382ba8ba2d6fc9a32c062bd4cff08b6f39b133838aa03115c39aeca0f654c7cc3ec72d87005bf8306e550824cd8eb9d60f0bd41784a3e22e17b2afcfe833
2018-08-28 16:25:04 +02:00
practicalswift 4c3c9c3869 Don't assert(...) with side effects 2018-08-28 10:22:28 +02:00
Jim Posen ed12d5df1b index: Fix for indexers skipping genesis block. 2018-08-27 17:03:24 -07:00
Chun Kuan Lee fe1ff5026b Hide spendable label if priveate key is disabled 2018-08-28 03:56:07 +08:00
John Newbery f7e9e70468 [rpc] Remove deprecated sigrawtransaction rpc method. 2018-08-27 14:36:12 -04:00
John Newbery 90c834089a [RPC] Remove warning about wallet addresses in createmultisig()
createmultisig() was updated in V0.16 to not use the wallet. Warning
text was included to warn the user. Remove that now.
2018-08-27 14:36:12 -04:00
John Newbery df905e390e [rpc] Remove deprecated validateaddress usage. 2018-08-27 14:36:08 -04:00
MarcoFalke fea4e9eca5
Merge #13767: Remove redundant assignments (dead stores)
dd777f3e12 Remove unused variable (practicalswift)
cdf4089457 Remove redundant assignments (dead stores) (practicalswift)

Pull request description:

  Remove redundant assignments (dead stores).

Tree-SHA512: e852059b22a161c34a0f18a6a6ed798e2b35e6d2b9f23c526af0ec33e01f6a5bb1fa5ada6671ba183d7b02393ff0d397be5aa4b4e2edbd5e604c9a76ac48d249
2018-08-27 13:39:46 -04:00
MarcoFalke dd34204611
Merge #13769: Mark single-argument constructors "explicit"
1ac3c983bf Mark single-argument constructors "explicit" (practicalswift)

Pull request description:

  Mark single-argument constructors `explicit`.

  Rationale:
  * Avoid unexpected implicit promotions.

  From the developer notes:

  > **By default, declare single-argument constructors explicit.**
  > Rationale: This is a precaution to avoid unintended conversions that might arise when single-argument constructors are used as implicit conversion functions.

Tree-SHA512: 7901ed5be808c9d0ecb5ca501e1bc0395987fe1b7941b8548cebac2ff08a14f7dab61fab374a69b9ba29a9295a04245c814325c7f95b97ae558af0780f111dfa
2018-08-27 13:33:04 -04:00
Chun Kuan Lee 1661a472b8 add unicode compatible file_lock for Windows
boost::interprocess::file_lock cannot open the files that contain characters which cannot be parsed by the user's code page on Windows.
This commit add a new class to handle those specific file for Windows.
2018-08-28 00:55:13 +08:00
Ben Woosley 1d9aa008d6
Explicitly initialize prevector _union 2018-08-27 09:50:13 -07:00
practicalswift f34c8c466a Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-08-27 18:19:33 +02:00
John Newbery 1f4b865e57 [wallet] Re-sort wallet RPC commands
This wasn't done in previous commit to make diff more reviewable.
2018-08-27 10:45:03 -04:00
John Newbery f0dc850bf6 [wallet] Remove wallet account RPCs
Also remove the RPC deprecation tests for accounts, and make one small
change to another wallet test that relies on account behaviour.
2018-08-27 10:45:01 -04:00
Chris Stewart b2f49bd732 Integration of property based testing into Bitcoin Core
update copyright headers

attempt to fix linting errors

Fixing issue with make check classifying generator files as actual unit tests

Wrapping gen files in ENABLE_PROPERTY_TESTS macro

Make macro better
2018-08-27 08:51:51 -05:00
John Newbery c410f41575 [tests] Remove wallet accounts test
The accounts API will be removed in the next commit. Remove all
functional tests for the accounts API.
2018-08-27 09:34:01 -04:00
MarcoFalke 6667490466
Merge #13987: Report minfeefilter value in getpeerinfo rpc
5778bf95d9 Report minfeefilter value in getpeerinfo rpc (Anthony Towns)

Pull request description:

  Lowering the minimum relay fee is only useful when many nodes in the p2p network also lower the fee, so to make it easier to understand progress on that front, this includes the value of the minfeefilter in getpeerinfo, so you at least have visibility to what fees your neighbours are currently accepting.

Tree-SHA512: 059f01bf2a32c98fce1648a13b7898701203b354d0209ee34e6683994b720eb594cf24968e66b699caae5e17e53d351e73281f042dd094decde14d3a318e9fb3
2018-08-27 07:28:38 -04:00
Anthony Towns 5778bf95d9 Report minfeefilter value in getpeerinfo rpc
Lowering the minimum relay fee is only useful when many nodes in the
p2p network also lower the fee, so to make it easier to understand
progress on that front, this includes the value of the minfeefilter in
getpeerinfo, so you at least have visibility to what fees your neighbours
are currently accepting.
2018-08-27 21:13:15 +10:00
Wladimir J. van der Laan e13a820f99
Merge #13861: test: Add testing of value_ret for SelectCoinsBnB
384273260a test: Add testing of value_ret for SelectCoinsBnB (Ben Woosley)

Pull request description:

  Fix that the early bailout optimization tests did not test the intended
  selection because their utxo pool was polluted by the make_hard_case test
  preceding. Note the code was tested, just not with the constructed case.

Tree-SHA512: 95f665525f5922f70f4c17708c0c09900f38d7a652b5bdd817e017ba7ff2865a6234edbd340064ffccc20d34048c45df86a4ac5f46dd8f4aab98834e71dc9d3c
2018-08-27 12:47:20 +02:00
Wladimir J. van der Laan 4a1a2148f6
Merge #14030: Remove ambiguity in construction of prevector
497e90c02b Remove default argument to prevector constructor to remove ambiguity (Ben Woosley)

Pull request description:

  The call with this default argument is redundant with `prevector(size_type)` on line 251.

Tree-SHA512: 4d22e6f4cd56e4b700596d7f5afc945ec6684636a94690fa16a1bbb34e4f53b6340f53a6c314fea213359426474125228ba7193388789f8a13308506358e92db
2018-08-27 12:23:48 +02:00
Wladimir J. van der Laan cb98effc5c
Merge #14031: Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5, don't patch clang
f1640d093f Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5 (Ben Woosley)

Pull request description:

  `std::is_trivially_constructible<T>` is equivalent to `std::is_trivially_default_constructible<T>`
  `std::has_trivial_default_constructor<T>` is the GCC < 5 name for `std::is_trivially_default_constructible<T>`

  https://en.cppreference.com/w/cpp/types/is_default_constructible
  https://www.gnu.org/software/gcc/gcc-5/changes.html

  `std::is_trivial` was also used when compiling with clang, due to clang's use of `__GNUC__`. Test `__clang__`  to target the intended implementations.
  https://stackoverflow.com/a/28166605

  All callers currently only pass one template argument to IS_TRIVIALLY_CONSTRUCTIBLE, with this change the build would fail if someone attempted passing more.

Tree-SHA512: 3e36ddf20a1c0d76ad94d7c95f3fe5b90f4ee00389d5516b35c657136205e7a3ddff60789b0b0b2375624631f15a51eaad3570ef19a7b9df1469a50ba28415d1
2018-08-27 12:00:21 +02:00
Wladimir J. van der Laan deed63f6fb
Merge #14056: Docs: Fix help message typo optiona -> optional
7d0a8ad310 Docs: Fix help message typo optiona -> optional (Ben Woosley)

Pull request description:

Tree-SHA512: 1812b45d912769f11280e3f72d7c8bd273f6d151797d5d32d21cd5a3bbe8725515406494291953be7a9afc02a2cef23bed1930ac3638f8118c0d8346ee8d6332
2018-08-27 10:48:35 +02:00
MarcoFalke e8061831e8
Merge #14071: qa: Stop txindex thread before calling destructor
faf4a9b674 qa: Stop txindex thread before calling destructor (MarcoFalke)

Pull request description:

  Same as #13894, but for the tests.

Tree-SHA512: a21d9f8ad8dc9703217d1808cb14bd969903c364fe30bbdc0dd2df170ddc0cbaba98b0bde28bc21ff1319222aaf6cb4f1b2c45cd6b236fe3c645a92eab6bacba
2018-08-26 22:04:32 -04:00
Chun Kuan Lee 23db9546c1 utils: run commands using utf-8 string on Windows 2018-08-27 03:24:34 +08:00
Wladimir J. van der Laan c775dc4a94
Merge #12254: BIP 158: Compact Block Filters for Light Clients
254c85b687 bench: Benchmark GCS filter creation and matching. (Jim Posen)
f33b717a85 blockfilter: Optimization on compilers with int128 support. (Jim Posen)
97b64d67da blockfilter: Unit test against BIP 158 test vectors. (Jim Posen)
a4afb9cadb blockfilter: Additional helper methods to compute hash and header. (Jim Posen)
cd09c7925b blockfilter: Serialization methods on BlockFilter. (Jim Posen)
c1855f6052 blockfilter: Construction of basic block filters. (Jim Posen)
53e7874e07 blockfilter: Simple test for GCSFilter construction and Match. (Jim Posen)
558c536e35 blockfilter: Implement GCSFilter Match methods. (Jim Posen)
cf70b55005 blockfilter: Implement GCSFilter constructors. (Jim Posen)
c454f0ac63 blockfilter: Declare GCSFilter class for BIP 158 impl. (Jim Posen)
9b622dc722 streams: Unit tests for BitStreamReader and BitStreamWriter. (Jim Posen)
fe943f99bf streams: Implement BitStreamReader/Writer classes. (Jim Posen)
87f2d9ee43 streams: Unit test for VectorReader class. (Jim Posen)
947133dec9 streams: Create VectorReader stream interface for vectors. (Jim Posen)

Pull request description:

  This implements the compact block filter construction in [BIP 158](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki). The code is not used anywhere in the Bitcoin Core code base yet. The next step towards [BIP 157](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki) support would be to create an indexing module similar to `TxIndex` that constructs the basic and extended filters for each validated block.

  ### Filter Sizes

  [Here](https://gateway.ipfs.io/ipfs/QmRqaAAQZ5ZX5eqxP7J2R1MzFrc2WDdKSWJEKtQzyawqog) is a CSV of filter sizes for blocks in the main chain.

  As you can see below, the ratio of filter size to block size drops after the first ~150,000 blocks:

  ![filter_sizes](https://user-images.githubusercontent.com/881253/42900589-299772d4-8a7e-11e8-886d-0d4f3f4fbe44.png)

  The reason for the relatively large filter sizes is that Golomb-coded sets only achieve good compression with a sufficient number of elements. Empirically, the average element size with 100 elements is 14% larger than with 10,000 elements.

  The ratio of filter size to block size is computed without witness data for basic filters. Here is a summary table of filter size ratios *for blocks after height 150,000*:

  | Stat | Filter Type |
  |-------|--------------|
  | Weighted Size Ratio Mean | 0.0198 |
  | Size Ratio Mean | 0.0224 |
  | Size Ratio Std Deviation | 0.0202 |
  | Mean Element Size (bits) | 21.145 |
  | Approx Theoretical Min Element Size (bits) | 21.025 |

Tree-SHA512: 2d045fbfc3fc45490ecb9b08d2f7e4dbbe7cd8c1c939f06bbdb8e8aacfe4c495cdb67c820e52520baebbf8a8305a0efd8e59d3fa8e367574a4b830509a39223f
2018-08-26 16:57:05 +02:00
MarcoFalke faf4a9b674
qa: Stop txindex thread before calling destructor 2018-08-26 10:18:06 -04:00
Jesse Cohen 737670c036 Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe 2018-08-26 09:41:57 -04:00
practicalswift 9e2de6b9d0 Move cs_main locking annotations from .cpp to .h 2018-08-26 11:15:17 +02:00
MarcoFalke 91186e5984
Merge #13083: Add compile time checking for cs_main runtime locking assertions
9e0a514112 Add compile time checking for all cs_main runtime locking assertions (practicalswift)

Pull request description:

  Add compile time checking for `cs_main` runtime locking assertions.

  This PR is a subset of #12665. The PR was broken up to make reviewing easier.

  The intention is that literally all `EXCLUSIVE_LOCKS_REQUIRED`/`LOCKS_EXCLUDED`:s added in this PR should follow either directly or indirectly from `AssertLockHeld(…)`/`AssertLockNotHeld(…)`:s already existing in the repo.

  Consider the case where function `A(…)` contains `AssertLockHeld(cs_foo)` (without
  first locking `cs_foo` in `A`), and that `B(…)` calls `A(…)` (without first locking `cs_main`):
  * It _directly_ follows that: `A(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.
  * It _indirectly_ follows that: `B(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.

Tree-SHA512: 120e7410c4c223dbc7d42030b1a19e328d01a55f041bb6fb5eaac10ac35cb0c5d469b9b3bda6444731164c73b88ac6495a00890672b107d9305e891571f64dd6
2018-08-25 18:31:29 -04:00
practicalswift 9e0a514112 Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
Wladimir J. van der Laan 6516b36731
Merge #12676: Show "bip125-replaceable" flag, when retrieving mempool entries
870bd4c73d Update functional RBF test to check replaceable flag (dexX7)
820d31f95f Add "bip125-replaceable" flag to mempool RPCs (dexX7)

Pull request description:

  This pull request adds a flag "bip125-replaceable" to the mempool RPCs getrawmempool, getmempoolentry, getmempoolancestors and getmempooldescendants, which indicates whether an unconfirmed transaction might be replaced.

  Initially the flag was added to the raw transaction RPCs, but thanks to @conscott, it was moved to the mempool RPCs, which actually have access to the mempool.

  ~~This pull request adds a flag "bip125-replaceable" to the RPCs "getrawtransaction" and "decoderawtransaction", which indicates, whether a transaction signals BIP 125 replaceability.~~

  There was some discussion in #7817, whether showing replaceability in the UI could lead to the false assumption that transactions that don't signal BIP 125 are truely non-replaceable, but given that this PR tackles the raw transaction interface, which is a rather low level tool, I believe having this extra piece of information isn't bad.

Tree-SHA512: 1f5511957af2c20a9a6c79d80a335c3be37a2402dbf829c40cceaa01a24868eab81a9c1cdb0b3d77198fa3bb82799e3540a5c0ce7f35bbac80d73f7133ff7cbc
2018-08-26 00:04:05 +02:00
Wladimir J. van der Laan 6f5372a171
Merge #13961: util: Replace boost::signals2 with std::function
ddddce0e46 util: Replace boost::signals2 with std::function (MarcoFalke)

Pull request description:

  This removes the `#include <boost/signals2/signal.hpp>` from `util.h` (hopefully speeding up the build time and reducing the memory usage further after  #13634)

  The whole translation interface is replaced by a function `G_TRANSLATION_FUN` that is set to nullptr in units that don't need translation. (Thus only set in the gui)

Tree-SHA512: 087c717358bbed8bdb409463e225239d667f1ced381abb10e7cd31a41dcdd2cebe20b43c2ee86f0f8e55d53301f75e963f07421a99a7ff4c0cad2c6a375c5ab1
2018-08-25 21:13:46 +02:00
Jim Posen 254c85b687 bench: Benchmark GCS filter creation and matching. 2018-08-25 10:02:37 -07:00
Jim Posen f33b717a85 blockfilter: Optimization on compilers with int128 support. 2018-08-25 10:02:37 -07:00
Jim Posen 97b64d67da blockfilter: Unit test against BIP 158 test vectors.
Full test of block filter and header construction.
2018-08-25 10:02:37 -07:00
Jim Posen a4afb9cadb blockfilter: Additional helper methods to compute hash and header. 2018-08-25 10:02:37 -07:00
Jim Posen cd09c7925b blockfilter: Serialization methods on BlockFilter. 2018-08-25 10:02:37 -07:00
Jim Posen c1855f6052 blockfilter: Construction of basic block filters. 2018-08-25 10:02:37 -07:00
Jim Posen 53e7874e07 blockfilter: Simple test for GCSFilter construction and Match. 2018-08-25 10:02:37 -07:00
Jim Posen 558c536e35 blockfilter: Implement GCSFilter Match methods. 2018-08-25 10:02:37 -07:00
Jim Posen cf70b55005 blockfilter: Implement GCSFilter constructors. 2018-08-25 10:02:37 -07:00
Jim Posen c454f0ac63 blockfilter: Declare GCSFilter class for BIP 158 impl. 2018-08-25 10:02:37 -07:00
Jim Posen 9b622dc722 streams: Unit tests for BitStreamReader and BitStreamWriter. 2018-08-25 10:02:37 -07:00
Jim Posen fe943f99bf streams: Implement BitStreamReader/Writer classes.
Golomb-Rice coding, as specified in BIP 158, involves operations on
individual bits. These classes will be used to implement the
encoding/decoding operations.
2018-08-25 10:02:37 -07:00
Jim Posen 87f2d9ee43 streams: Unit test for VectorReader class. 2018-08-25 10:02:37 -07:00
Jim Posen 947133dec9 streams: Create VectorReader stream interface for vectors.
This is a read analogue for the existing CVectorWriter.
2018-08-25 10:02:37 -07:00
Wladimir J. van der Laan 021dce935a
Merge #13946: p2p: Clarify control flow in ProcessMessage
fa6c3dea42 p2p: Clarify control flow in ProcessMessage() (MarcoFalke)

Pull request description:

  `ProcessMessage` is effectively a massive switch case construct. In the past there were attempts to clarify the control flow in `ProcessMessage()` by moving each case into a separate static function (see #9608). It was closed because it wasn't clear if moving each case into a function was the right approach.
  Though, we can quasi treat each case as a function by adding a return statement to each case. (Can be seen as a continuation of bugfix #13162)

  This patch does exactly that.

  Also note that this patch is a subset of previous approaches such as #9608 and #10145.

  Review suggestion: `git diff HEAD~ --function-context`

Tree-SHA512: 91f6106840de2f29bb4f10d27bae0616b03a91126e6c6013479e1dd79bee53f22a78902b631fe85517dd5dc0fa7239939b4fefc231851a13c819458559f6c201
2018-08-25 18:18:15 +02:00
Wladimir J. van der Laan 4cef8e0593
Merge #13429: Return the script type from Solver
984d72ec65 Return the script type from Solver (Ben Woosley)

Pull request description:

  Because false is synonymous with TX_NONSTANDARD, this conveys the same
  information and makes the handling explicitly based on script type,
  simplifying each call site.

  Prior to this change it was common for the return value to be ignored, or for the
  return value and TX_NONSTANDARD to be redundantly handled.

Tree-SHA512: 31864f856b8cb75f4b782d12678070e8b1cfe9665c6f57cfb25e7ac8bcea8a22f9a78d7c8cf0101c841f2a612400666fb91798bffe88de856e98b873703b0965
2018-08-25 17:41:00 +02:00
Wladimir J. van der Laan 776fa60c4b
Merge #13631: Add CMerkleTx::IsImmatureCoinBase method
23f4343781 Add CMerkleTx::IsImmatureCoinBase method (Ben Woosley)

Pull request description:

  All but one call to `GetBlocksToMaturity` is testing it relative to 0
  for the purposes of determining whether the coinbase tx is immature.
  In such case, the value greater than 0 implies that the tx is coinbase,
  so there is no need to separately test that status.

  This names the concept for easy singular use.

Tree-SHA512: 4470d07404a0707144f9827b9a94c5c4905f23ee6f9248edc5df599a59d28e21ea0201d8abe5d5d73b39cb05b60c861ea8e04767eef04433e2ee95dcfed653ee
2018-08-25 16:53:21 +02:00
Ben Woosley 7d0a8ad310
Docs: Fix help message typo optiona -> optional 2018-08-24 15:02:16 -07:00
Gregory Sanders 61fe653bd9 fix walletcreatefundedpsbt deriv paths, add test 2018-08-24 17:03:55 -04:00
MarcoFalke ddddce0e46
util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
Ben Woosley f1640d093f
Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5
std::is_trivially_constructible<T> is equivalent to std::is_trivially_default_constructible<T>
std::has_trivial_default_constructor<T> is the GCC < 5 name for std::is_trivially_default_constructible<T>

std::is_trivial was also used when compiling with clang, due to clang's use of __GNUC__. Test __clang__
to target the intended implementations.
2018-08-23 10:38:59 -07:00
Wladimir J. van der Laan 540bf8aacc
Merge #12559: Avoid locking cs_main in some wallet RPC
00f58f8c48 rpc: Avoid locking cs_main in some wallet RPC (João Barbosa)

Pull request description:

  Avoid locking `cs_main` in the folllowing wallet RPC:
   - `decoderawtransaction`
   - `getnewaddress`
   - `getrawchangeaddress`
   - `setlabel`

Tree-SHA512: 54089766b2a969a17479af6c60e8ce151fac1f8cec268d43c61e679d5d17e76d17e414240c9ca2bfd280165f3a04e24a51310eb283591cd601a7eebc8b2423ea
2018-08-23 19:38:18 +02:00
Gregory Maxwell 66b3fc5437 Skip stale tip checking if outbound connections are off or if reindexing. 2018-08-23 10:10:12 +00:00
Ben Woosley 497e90c02b
Remove default argument to prevector constructor to remove ambiguity
The call with this default argument is redundant with prevector(size_type).
2018-08-23 02:57:39 -07:00
Antoine Riard e8c4a1e369 Add new regtest ports in doc following #10825 ports reattributions
Add checkmempool and checkblockindex regtest true in doc
2018-08-23 03:14:11 +00:00
João Barbosa 00f58f8c48 rpc: Avoid locking cs_main in some wallet RPC 2018-08-23 01:46:59 +01:00
MarcoFalke fa5099ceb7
p2p: Remove dead code for nVersion=10300 2018-08-22 09:22:04 -04:00
Wladimir J. van der Laan 17d644901b
Merge #13988: Add checks for settxfee reasonableness
317f2cb3f4 test: Check RPC settxfee errors (João Barbosa)
48618daf26 Add checks for settxfee reasonableness (Anthony Towns)

Pull request description:

  When using the `settxfee` RPC, the value is silently ignored if it is less than either than minrelaytxfee or the wallet's mintxfee. This adds an error response if that's going to happen, but still allows "settxfee 0" to deliberately default to the minimum value.

Tree-SHA512: ce685584cf8d6b9ca2cc97196d494220e3892b6a804a458086e04b3a23df281da432ad0a3053106a064c90c541ddb6f6b96a27cf8376d45af1e44449baf88456
2018-08-22 11:10:41 +02:00
Wladimir J. van der Laan 0738b88fe0
Merge #13967: [walletdb] don't report minversion wallet entry as unknown
321159e53e don't report minversion wallet entry as unknown (Gregory Sanders)

Pull request description:

  It is known in WalletBatch::LoadWallet

Tree-SHA512: 82f7e12f48ae7d17317074ce5b5e27c70ba8334b04adbf7cc863f8169cc1aa460b9454571e2698aa00059c8c8f669fe19c0d40c4910dcded260ddca6ce78be9d
2018-08-22 10:02:11 +02:00
Wladimir J. van der Laan df29abf673
Merge #14006: Add const modifier to HTTPRequest methods
18c49eb887 http: Add const modifier to HTTPRequest methods (João Barbosa)

Pull request description:

Tree-SHA512: 233617425ff3abc7419817a95337056c190640197c6c4d8b1a0810967d960c0968d02967e16ffbc1af1a2b3117fdc98722bf05e270504d59548e6838fa7f5ffb
2018-08-21 17:33:12 +02:00
João Barbosa f78558f1e3 qt: Use new Qt5 connect syntax 2018-08-21 09:43:54 +01:00
Wladimir J. van der Laan 8aa9badf5e
Merge #13968: [wallet] couple of walletcreatefundedpsbt fixes
faaac5caaa RPCTypeCheck bip32derivs arg in walletcreatefunded (Gregory Sanders)
1f0c4282e9 QA: add basic walletcreatefunded optional arg test (Gregory Sanders)
1f18d7b591 walletcreatefundedpsbt: remove duplicate replaceable arg (Gregory Sanders)
2252ec5008 Allow ConstructTransaction to not throw error with 0-input txn (Gregory Sanders)

Pull request description:

  1) Previously an empty input argument transaction that is marked for replaceability fails to pass the `SignalsOptInRBF` check right before funding it. Explicitly check for that condition before throwing an error.

  2) The rpc call had two separate `replaceable` arguments, each of which being used in mutually exclusive places. I preserved the `options` version to retain compatability with `fundtransaction`.

Tree-SHA512: 26eb0c9e2d38ea51d11f741d61100223253271a084adadeb7e78c6d4e9004636f089e4273c5bf64a41bd7e9ff795317acf30531cb36aeb0d8db9304b3c8270c3
2018-08-21 09:44:26 +02:00
Russell Yanofsky a3197c5294 Disable wallet and address book Qt tests on macOS minimal platform
macOS Qt minimal platform is frequently broken, and these are currently failing
with Qt 5.11.1.

The tests do pass when run on the full cocoa platform
(with `test_bitcoin-qt -platform cocoa`).
2018-08-20 15:24:55 -04:00
MarcoFalke 4732fa133a
Merge #12818: [qt] TransactionView: highlight replacement tx after fee bump
d795c610d3 [qt] TransactionView: highlight replacement tx after fee bump (Sjors Provoost)

Pull request description:

  Consistent with #12421 which highlights the transaction after send.

  <img width="747" alt="1" src="https://user-images.githubusercontent.com/10217/38036280-a7358ea4-32a6-11e8-8f92-417e9e1e3e8b.png">

  <img width="685" alt="2" src="https://user-images.githubusercontent.com/10217/38036289-aac87040-32a6-11e8-9f94-81745ff6c592.png">

  ~I'm not too proud of the `QTimer::singleShot(10` bit; any suggestions on how to properly wait for the transactions table to become aware of the new transaction?~

  Although I could have called `focusTransaction()` directly from `TransactionView::bumpFee()` I'm using the same signal as the send screen. This should make it easier to move fee bump / transaction replacement functionality around later.

Tree-SHA512: 242055b7c3d32c7b2cf871f5ceda2581221902fd53fa29e0b092713fc16d3191adbe8cbb28417d522dda9febec8cc05e07afe3489cd7caaecd33460c1dde6fbc
2018-08-20 13:26:30 -04:00
Gregory Sanders faaac5caaa RPCTypeCheck bip32derivs arg in walletcreatefunded 2018-08-20 13:02:20 -04:00
Gregory Sanders 1f18d7b591 walletcreatefundedpsbt: remove duplicate replaceable arg 2018-08-20 13:02:20 -04:00
Kostiantyn Stepaniuk d9d79576f4 Preserve a format of RPC command definitions
Currently RPC commands are formatted in a way that it's easy to read
and that test/lint/check-rpc-mappings.py can parse it.

To void breaking test/lint/check-rpc-mappings.py script by running
clang-format, RPC command definitions should be disabled for clang-format.
2018-08-20 15:19:12 +02:00
Wladimir J. van der Laan 2a583406c0
Merge #13248: [gui] Make proxy icon from statusbar clickable
6d5fcad576 [gui] Make proxy icon from statusbar clickable (Cristian Mircea Messel)

Pull request description:

  Clicking on the proxy icon will open settings showing the network tab

  https://github.com/bitcoin/bitcoin/pull/11491#issuecomment-336685303

Tree-SHA512: c3549749296918818694a371326d1a3b1075478918aaee940b5c7119a7e2cb991dcfda78f20d44d6d001157b9b82951f0d5157b17f4f0d1a0a242795efade036
2018-08-20 13:40:11 +02:00
João Barbosa 18c49eb887 http: Add const modifier to HTTPRequest methods 2018-08-20 01:35:55 +01:00
Wladimir J. van der Laan 3c8d1ae153
Merge #13665: [build] Add risc-v support to gitian
c4aecd1d80 Add risc-v 64-bit to gitian (Chun Kuan Lee)
96dda8b058 [depends] Add riscv qt depends support for cross compiling bitcoin-qt (Chun Kuan Lee)

Pull request description:

  Based on ~#13660~ #13710 ,  add gitian tarball for RISC-V

Tree-SHA512: 8db73545a2ea7fe03fa156598479335ea3c79aa3fb9c5cc44b8563094b1deb7c94d29c1dab47fac129dbfa2e3e774301b526474beeeb59c9b0087d3ea087dbd6
2018-08-16 20:33:50 +02:00
Anthony Towns 48618daf26 Add checks for settxfee reasonableness 2018-08-16 12:47:31 +10:00
MarcoFalke fa6ab8ada1
rpc: Return more specific reject reason for submitblock 2018-08-15 14:09:35 -04:00
Wladimir J. van der Laan b5591ca0b0
Merge #13399: rpc: Add submitheader
fa091b0016 qa: Add tests for submitheader (MarcoFalke)
36b1b63f20 rpc: Expose ProcessNewBlockHeaders (MarcoFalke)

Pull request description:

  This exposes `ProcessNewBlockHeaders` as an rpc called `submitheader`. This can be used to check for invalid block headers and submission of valid block headers via the rpc.

Tree-SHA512: a61e850470f15465f88e450609116df0a98d5d9afadf36b2033d820933d8b6a4012f9f2b3246319c08a0e511bef517f5d808cd0f44ffca91d10895a938004f0b
2018-08-15 17:52:06 +02:00
Wladimir J. van der Laan ef98e122ca
Merge #13891: [RPC] Remove getinfo deprecation warning
b2f23c4153 [RPC] Remove getinfo deprecation warning (John Newbery)

Pull request description:

  `getinfo` was removed in V0.16. A removal warning message was left in place to tell users that the method had been removed. We can remove that entirely in V0.18.

Tree-SHA512: bf93fbcf57a9be480438dcbdcab2dfd69ce277218b10628776975b093b3ffd2caa1751e0fb4cb0245443c81465693e2b8750e96d3e38632a78bae5ffa04f9212
2018-08-15 17:10:43 +02:00
fanquake 4b3b85c597
refactor: use fs:: over boost::filesystem:: 2018-08-15 21:05:21 +08:00
MarcoFalke 80127f074e
Merge #13974: [trivial] Fix typo in CDiskBlockPos struct's ToString
8bd98a3846 [trivial] Fix typo in CDiskBlockPos struct's ToString (Jon Layton)

Pull request description:

  (Logging)

Tree-SHA512: 5c0334fda15b1d668b251107772ae527e6b5f63d10e6c75330107eec0db7195845fdb9e92781591bcad6720bc8ef5af5a77cccf883170c4dfd2090b8c7ce16bd
2018-08-15 08:01:49 -04:00
MarcoFalke e393a18b51
Merge #13964: ci: Add Appveyor CI
1f6ff04e59 Use wildcard path in test_bitcoin.vcxproj (Chun Kuan Lee)
90cc69c0c7 ci: Add appveyor.yml to build on MSVC (Chun Kuan Lee)
4d0c7924d2 Make macro compatible with MSVC (Chun Kuan Lee)

Pull request description:

  Introduce Appveyor CI for MSVC. This would require the owner adding appveyor to this repo. Also fix some MSVC incompatible code.

  This `appveyor.yml` file is modified from @sipsorcery and @NicolasDorier 's code in #12613.

  Appveyor CI result: https://ci.appveyor.com/project/ken2812221/bitcoin/build/1.0.151

Tree-SHA512: b5b0f1686a33e54325ea6de81606806a7d9a0f8d4acbb97c9ce598386e8fcb2220def264777609ed2b850ac8c490fd181303ea522c5a70487272d46995f4c52d
2018-08-15 07:55:39 -04:00
Jon Layton 8bd98a3846 [trivial] Fix typo in CDiskBlockPos struct's ToString 2018-08-14 18:03:43 -05:00
Gregory Sanders 2252ec5008 Allow ConstructTransaction to not throw error with 0-input txn 2018-08-14 14:28:29 -04:00
Wladimir J. van der Laan 63f8b0128b
Merge #13917: Additional safety checks in PSBT signer
5df6f089b5 More tests of signer checks (Andrew Chow)
7c8bffdc24 Test that a non-witness script as witness utxo is not signed (Andrew Chow)
8254e9950f Additional sanity checks in SignPSBTInput (Pieter Wuille)
c05712cb59 Only wipe wrong UTXO type data if overwritten by wallet (Pieter Wuille)

Pull request description:

  The current PSBT signing code can end up producing a non-segwit signature, while only the UTXO being spent is provided in the PSBT (as opposed to the entire transaction being spent). This may be used to trick a user to incorrectly decide a transaction has the semantics he intends to sign.

  Fix this by refusing to sign if there is any mismatch between the provided data and what is being signed.

Tree-SHA512: b55790d79d8166e05513fc4c603a982a33710e79dc3c045060cddac6b48a1be3a28ebf8db63f988b6567b15dd27fd09bbaf48846e323c8635376ac20178956f4
2018-08-14 18:01:02 +02:00
Gregory Sanders 321159e53e don't report minversion wallet entry as unknown 2018-08-14 11:34:27 -04:00
Wladimir J. van der Laan 3e5424faf6
Merge #13960: Fix PSBT deserialization of 0-input transactions
bd19cc78cf Serialize non-witness utxo as a non-witness tx but always deserialize as witness (Andrew Chow)
43811e6338 Fix PSBT deserialization of 0-input transactions (Andrew Chow)

Pull request description:

  0-input transactions can be ambiguously deserialized as being witness transactions. Since the unsigned transaction is never serialized as a witness transaction as it has no witnesses, we should always deserialize it as a non-witness transaction and set the serialization flags as such.

  When a transaction is serliazed for the non-witness-utxo, it is always a valid network transaction and thus it should be always be deserialized as a witness transaction and the deserialzation flags are set as such.

  Fixes #13958

Tree-SHA512: 1937b3cb2618534478d4f533541fb9efce3cb5badb5d1964bfe19400f4aacc6c8ecedaf1f20d26b20baf94f81fd07dfb15b3b08089ecbd63aeecbc18c7c48086
2018-08-14 16:52:36 +02:00
Chun Kuan Lee 4d0c7924d2 Make macro compatible with MSVC 2018-08-14 09:19:47 +00:00
Wladimir J. van der Laan db3cb5c5a6
Merge #13948: trivial: Removes unsed CBloomFilter constructor.
265bd50884 Removes unsed `CBloomFilter` constructor. (251)

Pull request description:

  This pull request removes the `CBloomFilter::CBloomFilter(const unsigned int, const double, const unsigned int)` constructor, which became obsolete with 086ee67.

Tree-SHA512: 46742f178e219661e82609a9bf6b644ebc58ab3efc2d1865c5562980e84f16a5fa286be9813738196ad7a27e639dee926062538eb44cadd67ab87ad5e9a266ba
2018-08-14 10:58:44 +02:00
Carl Dong 16bcc1b823 Remove unused dummy_tx variable from FillPSBT 2018-08-13 18:45:26 -07:00
Andrew Chow bd19cc78cf Serialize non-witness utxo as a non-witness tx but always deserialize as witness
Strip out the witnesses when serializing the non-witness utxo. However
witness serializations are allowed, so make sure we always deserialize
as witness.
2018-08-13 15:00:06 -07:00
Andrew Chow 43811e6338 Fix PSBT deserialization of 0-input transactions
0-input transactions can be ambiguously deserialized as being witness
transactions. Since the unsigned transaction is never serialized as
a witness transaction as it has no witnesses, we should always
deserialize it as a non-witness transaction and set the serialization
flags as such.

Also always serialize the unsigned transaction as a non-witness transaction.
2018-08-13 14:59:31 -07:00
MarcoFalke ddc3ec92b0
Merge #13634: ui: Compile boost::signals2 only once
fa5ce27385 ui: Compile boost:signals2 only once (MarcoFalke)

Pull request description:

  ui is one of the modules that poison other modules with `boost/signals2` headers. This moves the include to the cpp file and uses a forward declaration in the header.

  Locally this speeds up the incremental build (building everything that uses the ui module) with gcc by ~5% for me. Gcc uses ~5% less memory.

  Would be nice if someone could verify the numbers roughly.

  I presume the improvements will be more pronounced if the other models would stop exposing the boost header as well.

Tree-SHA512: 078360eba330ddbca4268bd8552927eae242a239e18dfded25ec20be72650a68cd83af7ac160690249b943d33ae35d15df1313f1f60a0c28b9526853aa7d1e40
2018-08-13 15:02:38 -04:00
MarcoFalke 36b1b63f20 rpc: Expose ProcessNewBlockHeaders 2018-08-13 14:27:40 -04:00
Pieter Wuille 917353c8b0 Make SignPSBTInput operate on a private SignatureData object 2018-08-13 08:46:23 -07:00
Pieter Wuille cad5dd2368 Pass HD path data through SignatureData 2018-08-13 08:46:23 -07:00
Pieter Wuille 03a99586a3 Implement key origin lookup in CWallet 2018-08-13 08:46:23 -07:00
Pieter Wuille 3b01efa0d1 [MOVEONLY] Move ParseHDKeypath to utilstrencodings 2018-08-13 08:46:23 -07:00
Pieter Wuille 81e1dd5ce1 Generalize PublicOnlySigningProvider into HidingSigningProvider 2018-08-13 08:46:23 -07:00
Pieter Wuille 84f1f1bfdf Make SigningProvider expose key origin information 2018-08-13 08:46:23 -07:00
Pieter Wuille 611ab307fb Introduce KeyOriginInfo for fingerprint + path 2018-08-13 08:46:23 -07:00
Pieter Wuille 8254e9950f Additional sanity checks in SignPSBTInput 2018-08-13 08:21:16 -07:00
Pieter Wuille c05712cb59 Only wipe wrong UTXO type data if overwritten by wallet 2018-08-13 08:21:16 -07:00
MarcoFalke f87d0a9d75
Merge #13534: Don't assert(foo()) where foo() has side effects
6ad0328f1c Don't assert(foo()) where foo has side effects (practicalswift)

Pull request description:

  Don't `assert(foo())` where `foo` has side effects.

  From `assert(3)`:

  > If the macro `NDEBUG` is defined at the moment `<assert.h>` was last included, the macro `assert()` generates no code, and hence does nothing at all.

  Bitcoin currently cannot be compiled without assertions, but we shouldn't rely on that.

Tree-SHA512: 28cff0c6d1c2fb612ca58c9c94142ed01c5cfd0a2fecb8e59cdb6c270374b215d952ed3491d921d84dc1b439fa49da4f0e75e080f6adcbc6b0e08be14e54c170
2018-08-13 10:02:50 -04:00
MarcoFalke 3bd25c010c
Merge #13899: build: Enable -Wredundant-decls where available. Remove redundant redeclarations.
d56b73f217 Remove redundant extern (practicalswift)
f04bb1361c Enable -Wredundant-decls (gcc) if available (practicalswift)
a9e90e5002 Remove redundant redeclaration of rescanblockchain(...) in same scope (practicalswift)

Pull request description:

  Remove redundant redeclaration of `rescanblockchain` and enable `-Wredundant-decls` (gcc) where available to avoid accidental redundant redeclarations.

  ```
   CXX      wallet/libbitcoin_wallet_a-rpcwallet.o
  wallet/rpcwallet.cpp:4764:17: warning: redundant redeclaration of ‘UniValue rescanblockchain(const JSONRPCRequest&)’ in same scope [-Wredundant-decls]
   extern UniValue rescanblockchain(const JSONRPCRequest& request);
                   ^~~~~~~~~~~~~~~~
  wallet/rpcwallet.cpp:3929:10: note: previous declaration of ‘UniValue rescanblockchain(const JSONRPCRequest&)’
   UniValue rescanblockchain(const JSONRPCRequest& request)
            ^~~~~~~~~~~~~~~~
  ```

Tree-SHA512: b9af95fa53f494c3f6702e485956b66b042d2ff7578b4a53bf28e91aa844cdcf5d7ac3e2e710948eed566007324e81317304b8eabf2d4ea284cd6acd77f8ffcd
2018-08-13 09:55:35 -04:00
MarcoFalke f083ec13c3
Merge #13938: refactoring: Cleanup StartRest()
2da54f5a66 Cleanup StartRest() (DesWurstes)

Pull request description:

Tree-SHA512: 7e907315009c0351b7a3347ec13b6727abd12fe722d51cc061cb635ea20f9a550af5f50dc364c4313501b0dfc3696bcfa26a2a5f0170a4b5808624e043085d29
2018-08-13 09:42:50 -04:00
Wladimir J. van der Laan 825fb02ef1 net: Update hardcoded seeds
Pre-0.17 branch hardcoded seeds update.
2018-08-13 13:57:15 +02:00
MarcoFalke 73a09b4458
Merge #13905: docs: fixed bitcoin-cli -help output for help2man
869193f5a6 docs: fixed bitcoin-cli -help output for help2man (Hennadii Stepanov)

Pull request description:

  Currently `bitcon-cli -help` output forces help2man to produce `.TP` and `.IP` commands instead of a single `.IP` command for `-stdinrpcpass`  option.
  Removing an extra space fixes this issue.

  This pull request is rebased from #13879

Tree-SHA512: 1c5b25ed2ef7b7de42bc6210165bdbabe63f045699487f2db4790e0d3176f6493dfd3e8e19f4ddc38b551539465d7b41aea570f20dccbc0609f00fdfee1b5180
2018-08-13 07:33:33 -04:00
MarcoFalke a9c56b6634
Merge #13918: rpc: Replace median fee rate with feerate percentiles in getblockstats
4b7091a842 Replace median fee rate with feerate percentiles (Marcin Jachymiak)

Pull request description:

  Currently,  the `medianfeerate` statistic is calculated from the feerate of the middle transaction of a list of transactions sorted by feerate.

  This PR instead uses the value of the 50th percentile weight unit in the block, and also calculates the feerate at the 10th, 25th, 75th, and 90th percentiles.  This more accurately corresponds with what is generally meant by median feerate.

Tree-SHA512: 59255e243df90d7afbe69839408c58c9723884b8ab82c66dc24a769e89c6d539db1905374a3f025ff28272fb25a0b90e92d8101103e39a6d9c0d60423a596714
2018-08-13 07:18:25 -04:00
Wladimir J. van der Laan 2115cba9c6
Merge #13666: Always create signatures with Low R values
e306be7429 Use 72 byte dummy signatures when watching only inputs may be used (Andrew Chow)
48b1473c89 Use 71 byte signature for DUMMY_SIGNATURE_CREATOR (Andrew Chow)
18dfea0dd0 Always create 70 byte signatures with low R values (Andrew Chow)

Pull request description:

  When creating signatures for transactions, always make one which has a 32 byte or smaller R and 32 byte or smaller S value. This results in signatures that are always less than 71 bytes (32 byte R + 32 byte S + 6 bytes DER + 1 byte sighash) with low R values. In most cases, the signature will be 71 bytes.

  Because R is not mutable in the same way that S is, a low R value can only be found by trying different nonces. RFC 6979 for deterministic nonce generation has the option to specify additional entropy, so we simply use that and add a uin32_t counter which we increment in order to try different nonces. Nonces are sill deterministically generated as the nonce used will the be the first one where the counter results in a nonce that results in a low R value. Because different nonces need to be tried, time to produce a signature does increase. On average, it takes twice as long to make a signature as two signatures need to be created, on average, to find one with a low R.

  Having a fixed size signature makes size calculations easier and also saves half a byte of transaction size, on average.

  DUMMY_SIGNATURE_CREATOR has been modified to produce 71 byte dummy signatures instead of 72 byte signatures.

Tree-SHA512: 3cd791505126ce92da7c631856a97ba0b59e87d9c132feff6e0eef1dc47768e81fbb38bfbe970371bedf9714b7f61a13a5fe9f30f962c81734092a4d19a4ef33
2018-08-13 12:07:20 +02:00
Wladimir J. van der Laan 13d51a2b61
Merge #13808: wallet: shuffle coins before grouping, where warranted
18f690ec2f wallet: shuffle coins before grouping, where warranted (Karl-Johan Alm)

Pull request description:

  Coins are randomly shuffled in coin selection to avoid unintentional privacy leaks regarding the user's coin set. For the case where a user has a lot of coins with the same destination, these will be grouped into groups of 10 *before* the shuffling.

  It is unclear whether this has any implications at all, but this PR plugs the potential issue, if there ever is one, by shuffling the coins before they are grouped.

  Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204554549

Tree-SHA512: fb50ed4b5fc03ab4853d45b76e1c64476ad5bcd797497179bc37b9262885c974ed6811159fd8e581f1461b6cc6d0a66146f4b70a2777c0f5e818d1322e0edb89
2018-08-13 11:36:39 +02:00
Hennadii Stepanov 869193f5a6 docs: fixed bitcoin-cli -help output for help2man
The `help2man` parses a string containing two spaces between words with an issue:
it gives out `.TP` and `.IP` commands instead of a single `.IP` command.
Removing an extra space fixes this issue.
Currently the `-help` output for the `-stdin` option looks without any issue due to eliminating
of two spaces between words by a `FormatParagraph` call for this particular case.
For consistency and preventing from future regressions extra spaces have been removed from the both lines.
The redundant `strprintf` call has been removed aswell.
2018-08-13 12:12:03 +03:00
Wladimir J. van der Laan b0d3e9b102
qt: Translations update before 0.17 branch
Make sure that translations are synchronized with transifex before the
branch-off point to minimize the difference and prevent duplicate work.

Tree-SHA512: 41e71eaf14094606fd90011d035c551a635d5a715f865a49841dbe2b54a76b7fbf59a7918f86e5fd80a717e2934a9613fe463391fd01848d0a01e5c4e7e7fef0
2018-08-13 11:00:17 +02:00
251 265bd50884 Removes unsed CBloomFilter constructor.
This commit removes the `CBloomFilter::CBloomFilter(const unsigned int, const double, const unsigned int)` constructor, which became obsolete with 086ee67.
2018-08-13 01:24:55 +02:00
MarcoFalke fa6c3dea42
p2p: Clarify control flow in ProcessMessage() 2018-08-12 15:07:45 -04:00
Marcin Jachymiak 4b7091a842 Replace median fee rate with feerate percentiles
Removes medianfeerate result from getblockstats.
Adds feerate_percentiles which give the feerate of the 10th, 25th, 50th,
75th, and 90th percentile weight unit in the block.
2018-08-11 15:00:17 -04:00
DesWurstes 2da54f5a66 Cleanup StartRest() 2018-08-11 09:34:47 +03:00
MarcoFalke d6faea4f91
Merge #13908: [Docs] upgrade rescan time warning from minutes to >1 hour
bb5b1c0b2d [Docs] upgrade rescan time warning from minutes to >1 hour (Mason Simon)

Pull request description:

  When I rescanned just now it took well over an hour. The time warning "may take minutes" didn't prepare me for that.

  ```
  2018-08-08T03:10:17Z [wallet] Still rescanning. At block 174747. Progress=0.008341
  2018-08-08T03:11:17Z [wallet] Still rescanning. At block 204233. Progress=0.024533
  2018-08-08T03:12:17Z [wallet] Still rescanning. At block 221170. Progress=0.038340
  ...
  2018-08-08T04:16:17Z [wallet] Still rescanning. At block 524815. Progress=0.957105
  2018-08-08T04:17:17Z [wallet] Still rescanning. At block 528572. Progress=0.971323
  2018-08-08T04:18:17Z [wallet] Still rescanning. At block 532458. Progress=0.986824
  ```

  This is on a 4-core 4ghz system with a 7200rpm drive.

Tree-SHA512: 722ccf566bfd6a3381fa173e08849cb676fe4c1f1cb2c4b86b07df2a5dc1ca0d54797cbe8fd606cdc2c60fef2be7c98e052460decdac2132ba759cff822132e8
2018-08-10 21:36:18 -04:00
lucash.dev@gmail.com a679109be4 Speed up knapsack_solver_test by not recreating wallet 100 times.
Moved the code for creating the wallet out of the 100-times repetition loop, for the most time-consuming tests.
2018-08-10 18:33:47 -07:00
MarcoFalke bced8ea71a
Merge #13927: rpc: Use pushKV in some new PSBT RPCs
227d27e70c Use pushKV in some new PSBT RPCs. (Daniel Kraft)

Pull request description:

  Most of the code uses `UniValue::pushKV` where appropriate, but some new RPC code related to PSBTs did not.  This fixes those places - after this change, there are no remaining source files I could find that contain `push_back(Pair(`.

Tree-SHA512: d6567cf144d05d7e42276bd66ff4cd44413328f985772d11bb9d7339d32ab7c3438d4bb0040a37e75f8d193c610b08fa971073935885e0a178546aa045daf9fa
2018-08-10 21:33:10 -04:00
Wladimir J. van der Laan 48bf8ff5b1
Merge #13907: Introduce a maximum size for locators.
e254ff5d53 Introduce a maximum size for locators. (Gregory Maxwell)

Pull request description:

  The largest sensible size for a locator is log in the number of blocks.
   But, as noted by Coinr8d on BCT a maximum size message could encode a
   hundred thousand locators.  If height were used to limit the messages
   that could open new attacks where peers on long low diff forks would
   get disconnected and end up stuck.

  Ideally, nodes first first learn to limit the size of locators they
   send before limiting what would be processed, but common implementations
   back off with an exponent of 2 and have an implicit limit of 2^32
   blocks, so they already cannot produce locators over some size.

  Locators are cheap to process so allowing a few more is harmless,
   so this sets the maximum to 64-- which is enough for blockchains
   with 2^64 blocks before the get overhead starts increasing.

Tree-SHA512: da28df9c46c988980da861046c62e6e7f93d0eaab3083d32e408d1062f45c00316d5e1754127e808c1feb424fa8e00e5a91aea2cc3b80326b71c148696f7cdb3
2018-08-10 19:52:13 +02:00
Wladimir J. van der Laan 71dec5c81f
Merge #13925: Merge leveldb subtree
ec749b1bcd Squashed 'src/leveldb/' changes from 64052c76c5..524b7e36a8 (MarcoFalke)

Pull request description:

  For review:

  ```sh
  git fetch https://github.com/bitcoin-core/leveldb
  ./test/lint/git-subtree-check.sh src/leveldb
  ```

  Closes #13860

Tree-SHA512: 9d13384fe35e7144b4a7fca57efe77b0cc5295952da4a397e4c6d8aa3f8043d5113fccedd3ae1dcaa3d2649e732e5f57a71504847946e055aa4dc8c3780e29fc
2018-08-10 19:48:14 +02:00
Andrew Chow e306be7429 Use 72 byte dummy signatures when watching only inputs may be used
With watching only inputs, we do not know how large the signatures
for those inputs will be as their signers may not have implemented
71 byte signatures. Thus we estimate their fees using the 72 byte
dummy signature to ensure that we pay enough fees.

This only effects fundrawtransaction when includeWatching is true.
2018-08-09 18:39:56 -07:00
Andrew Chow 48b1473c89 Use 71 byte signature for DUMMY_SIGNATURE_CREATOR
Changes DUMMY_SIGNATURE_CREATOR to create 71 byte dummy signatures.

Update comments to reflect this change
2018-08-09 18:39:56 -07:00
Andrew Chow 18dfea0dd0 Always create 70 byte signatures with low R values
When extra entropy is not specified by the caller, CKey::Sign will
now always create a signature that has a low R value and is at most
70 bytes. The resulting signature on the stack will be 71 bytes when
the sighash byte is included.

Using low R signatures means that the resulting DER encoded signature
will never need to have additional padding to account for high R
values.
2018-08-09 18:39:56 -07:00
Karl-Johan Alm 18f690ec2f
wallet: shuffle coins before grouping, where warranted
Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257\#discussion_r204554549
2018-08-10 09:08:11 +09:00
Gregory Maxwell e254ff5d53 Introduce a maximum size for locators.
The largest sensible size for a locator is log in the number of blocks.
 But, as noted by Coinr8d on BCT a maximum size message could encode a
 hundred thousand locators.  If height were used to limit the messages
 that could open new attacks where peers on long low diff forks would
 get disconnected and end up stuck.

Ideally, nodes first first learn to limit the size of locators they
 send before limiting what would be processed, but common implementations
 back off with an exponent of 2 and have an implicit limit of 2^32
 blocks, so they already cannot produce locators over some size.

This sets the limit to an absurdly high amount of 101 in order to
 maximize compatibility with existing software.
2018-08-09 20:54:01 +00:00
Andrew Chow c1dde3a949 No longer shutdown after encrypting the wallet
Since the database environment is flushed, closed, and reopened during
EncryptWallet, there is no need to shut down the software anymore.
2018-08-09 11:28:33 -07:00
Andrew Chow d7637c5a3f After encrypting the wallet, reload the database environment
Calls ReloadDbEnv after encrypting the wallet so that the database
environment is flushed, closed, and reopened to prevent unencrypted
keys from being saved on disk.
2018-08-09 11:27:39 -07:00
Andrew Chow 5d296ac810 Add function to close all Db's and reload the databae environment
Adds a ReloadDbEnv function to BerkeleyEnvironment in order to close all Db
instances, closes the environment, resets it, and then reopens
the BerkeleyEnvironment.

Also adds a ReloadDbEnv function to BerkeleyDatabase that calls
BerkeleyEnvironment's ReloadDbEnv.
2018-08-09 11:27:39 -07:00
Andrew Chow a769461d5e Move BerkeleyEnvironment deletion from internal method to callsite
Instead of having the object destroy itself, having the caller
destroy it.
2018-08-09 11:27:39 -07:00
Daniel Kraft 227d27e70c Use pushKV in some new PSBT RPCs.
Most of the code uses UniValue::pushKV where appropriate, but some new
RPC code related to PSBTs did not.
2018-08-09 18:08:45 +02:00
MarcoFalke fa14fa742d
Merge leveldb subtree
Merge commit 'ec749b1bcdf2483b642fb51d635800e272c68ba6' into HEAD
2018-08-09 11:31:45 -04:00
MarcoFalke 3e3a50aeb8
Merge #13911: doc: Revert translated string change, clarify wallet log messages
c4a884d555 Trivial: Revert translated string change, clarify wallet log messages (Pierre Rochard)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/pull/12992 post-merge nits from @jnewbery

Tree-SHA512: 002d8a69b489fd216e15b7d6200d7117c489b32405d5e9f514f120d43113fd97ca2f235452b0093e0760bc03baf714edc4564ae14af8456e1b2a54f83c577bf3
2018-08-09 08:11:17 -04:00
MarcoFalke 8eb9870052
Merge #13876: wallet: Catch filesystem_error and raise InitError
fa8527ffec wallet: Catch filesystem_error and raise InitError (MarcoFalke)

Pull request description:

  Fixes #13754 by restoring the previous behaviour

Tree-SHA512: f64052e89f6b332be395df2a5ea6f227c213fa2f38e415e83f30a4fad0938e947e5cddff7902368a43c07be135955a31b90f7eac5a46875c58d54ea95f87f6e6
2018-08-09 08:03:23 -04:00
practicalswift 0e534d4dca Fix incorrect Doxygen comments 2018-08-08 22:14:45 +02:00
Chun Kuan Lee c4aecd1d80 Add risc-v 64-bit to gitian 2018-08-09 03:35:51 +08:00
Pierre Rochard c4a884d555 Trivial: Revert translated string change, clarify wallet log messages 2018-08-08 11:00:55 -04:00
Wladimir J. van der Laan df9f712746
Merge #13894: shutdown: Stop threads before resetting ptrs
faab63111d shutdown: Stop threads before resetting ptrs (MarcoFalke)

Pull request description:

  On shutdown some threads would continue to run after or during a pointer reset. This leads to occasional segfaults on shutdown.

  Fix this by resetting the smart pointers after all threads that might read from them have been stopped.

  This should fix:
  * A segfault in the txindex thread, that occurs when the txindex destructor is done, but the thread was not yet stopped (as this is done in the base index destructor)
  * A segfault in the scheduler thread, which dereferences conman. (e.g. CheckForStaleTipAndEvictPeers)

Tree-SHA512: abbcf67fadd088e10fe8c384fadfb90bb115d5317145ccb5363603583b320efc18131e46384f55a9bc574969013dfcbd08c49e0d42c004ed7212eca193858ab2
2018-08-08 15:19:00 +02:00
Wladimir J. van der Laan 78dae8cacc
Merge #13780: 0.17: Pre-branch maintenance
3fc20632a3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot)
2b6a2f4a28 Regenerate manpages (DrahtBot)
eb7daf4d60 Update copyright headers to 2018 (DrahtBot)

Pull request description:

  Some trivial maintenance to avoid having to do it again after the 0.17 branch off.

  (The scripts to do this are in `./contrib/`)

Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
2018-08-08 13:55:27 +02:00
Daniel Kraft e58985c916 Log progress while verifying blocks at level 4.
When verifying blocks at startup, the progress is printed in 10%
increments to logs.  When -checklevel=4, however, the second half
of the verification (connecting the blocks again) does not log the
progress anymore.  (It is still computed and shown in the UI, but
not printed to logs.)

This change makes the behaviour consistent, by adding the missing
progress logging also for level-4 checks.
2018-08-08 13:22:13 +02:00
Mason Simon bb5b1c0b2d [Docs] upgrade rescan time warning from minutes to >1 hour 2018-08-07 22:39:34 -07:00
Ben Woosley 5eb20f81d9
Consistently use ParseHashV to validate hash inputs in rpc
ParseHashV validates the length and encoding of the string and throws
an informative RPC error on failure, which is as good or better than
these alternative calls.

Note I switched ParseHashV to check string length first, because
IsHex tests that the length is even, and an error like:
"must be of length 64 (not 63, for X)" is much more informative than
"must be hexadecimal string (not X)"
2018-08-07 12:47:39 -04:00
Wladimir J. van der Laan 9d86aad287
Merge #13812: wallet: sum ancestors rather than taking max in output groups
23fbbb100f wallet: sum ancestors rather than taking max in output groups (Karl-Johan Alm)

Pull request description:

  This is pointed out in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204549758.

  Basically, the ancestors gives an indication as to how many ancestors the resulting transaction will have, which is more precise when summing up the values, rather than taking the maximum, since all the coins in the group will become ancestors if selected.

Tree-SHA512: 0588c4b6059669650614817e041526a2ab89dda8c07fca8e077c7669dca1fed51cd164f7df56340840ab60285d48f3b140dcee64f64bf696b2dd4ab16d556a13
2018-08-07 17:23:04 +02:00
Wladimir J. van der Laan e8f387f997
Merge #13843: [trivial] Add doxygen-compatible comments to CAffectedKeysVisitor
3339d84535 [trivial] add doxygen-compatible comments to CAffectedKeysVisitor (Pierre Rochard)

Pull request description:

Tree-SHA512: 0003fde198a6977d0c8988efc8f76428f9e095009fddf131b07bd9809ef76a778c86bb2b1305e33df16101b6b703cf43eb6193462bb9f3687f98c1d9b109dd96
2018-08-07 16:49:18 +02:00
MarcoFalke fa5ce27385
ui: Compile boost:signals2 only once 2018-08-07 10:49:10 -04:00
MarcoFalke 1cd5f2cf9a
Merge #13895: Docs: fix GetWarnings docs to reflect behavior
13bb5cae31 Docs: fix GetWarnings docs to reflect behavior (Ben Woosley)

Pull request description:

  In "gui", it returns all warnings, joined by a separator
  In "statusbar", it returns the last warning set which seems notionally to be the most important, though that is debatable

Tree-SHA512: 5fc0dc68d143a040b7b893b7176188e2b064c2cf1d559420906e4de636e16e9ab7451a1b87603020a7a8f66d6b94f4ee6c7da2697efad879f9e6de9c0e0c9ac1
2018-08-07 10:30:31 -04:00
Wladimir J. van der Laan e7ea858729
Merge #13527: policy: Remove promiscuousmempoolflags
faa24441ec policy: Remove promiscuousmempoolflags (MarcoFalke)

Pull request description:

  It seems odd to clutter validation code with features that can only ever be used for testing (testnet or regtest). Removing that test-only code makes the mempool logic less painful to understand and easier to reason about when changed or refactored in the future.

Tree-SHA512: 3b897aa9604ac8d82ebe9573c6efd468c93ddaa08d378ebc902e247b7aa6c68fcde71e5b449c08f17a067146cdc66dc50a67ce06d07607c27e5189a49c3fba3f
2018-08-07 15:45:37 +02:00
Wladimir J. van der Laan 51c693d49e
Merge #13657: wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity
93de2891fa wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity (Ben Woosley)

Pull request description:

  According to my understanding, it should not be possible for coinbase
  transactions to be conflicting, thus it should not be possible for
  GetDepthInMainChain to return a negative result. If it did, this would
  also result in innacurate results for GetBlocksToMaturity due to the
  math therein. asserting ensures accuracy.

Tree-SHA512: 8e71c26f09fe457cfb00c362ca27066f7f018ea2af1f395090fdc7fd9f5964b76f4317c23f7a4923776f00087558511da5c1c368095be39fb1bacc614a93c32f
2018-08-07 14:19:50 +02:00
Wladimir J. van der Laan b81a8a5ea9
Merge #13667: wallet: Fix backupwallet for multiwallets
a1a998cf24 wallet: Fix backupwallet for multiwallets (Daniel Kraft)

Pull request description:

  `backupwallet` was broken for multiwallets in their own directories (i.e. something like `DATADIR/wallets/mywallet/wallet.dat`).  In this case, the backup would use `DATADIR/wallets/wallet.dat` as source file and not take the specific wallet's directory into account.

  This led to either an error during the backup (if the wrong source file was not present) or would silently back up the wrong wallet; especially the latter behaviour can be quite bad for users.

Tree-SHA512: 7efe2450ca047e40719fcc7cc211ed94699056020ac737cada7b59e8240298675960570c45079add424d0aab520437d5050d956acd695a9c2452dd4317b4d2c4
2018-08-07 13:31:54 +02:00
Wladimir J. van der Laan 37ab117a87
Merge #13872: [docs] Reformat -help output for help2man
7272fdcfe7 [docs] Reformat -help output for help2man (Tim Ruffing)

Pull request description:

  This commit slightly changes the format of the "Usage" strings in CLI
  `-help` messages to meet the expection of the help2man tool, which we
  use to generate man pages. On the way, we remove a few calls to
  `strprintf()`, which became superficial after commit 32fbfda.

  Before:
  ![screenshot from 2018-08-04 12-11-25](https://user-images.githubusercontent.com/1071625/43675564-6e2e016c-97e2-11e8-8de7-0912a4088efd.png)
  After:
  ![screenshot from 2018-08-04 12-11-46](https://user-images.githubusercontent.com/1071625/43675566-712d7032-97e2-11e8-85a7-5decc6dcb4b2.png)

Tree-SHA512: 9752ee0d0fde0b084e00232609866291ff493f4feb45919279b0f142b04635c049ddd2bf71ff6ad57d4ae1ed37103348640d253bb4f0b3e16b7fd2bb4b2a6fba
2018-08-07 10:32:53 +02:00
practicalswift d56b73f217 Remove redundant extern 2018-08-07 09:34:45 +02:00
practicalswift a9e90e5002 Remove redundant redeclaration of rescanblockchain(...) in same scope 2018-08-06 23:52:35 +02:00
Ben Woosley 13bb5cae31
Docs: fix GetWarnings docs to reflect behavior
In "gui", it returns all warnings, joined by a separator
In "statusbar", it returns just the first warning
2018-08-06 17:16:15 -04:00
MarcoFalke faab63111d
shutdown: Stop threads before resetting ptrs 2018-08-06 16:35:41 -04:00
John Newbery b2f23c4153 [RPC] Remove getinfo deprecation warning 2018-08-06 11:20:27 -04:00
MarcoFalke fa8527ffec
wallet: Catch filesystem_error and raise InitError 2018-08-04 12:04:38 -04:00
Tim Ruffing 7272fdcfe7 [docs] Reformat -help output for help2man
This commit slightly changes the format of the "Usage" strings in CLI
`-help` messages to meet the expection of the help2man tool, which we
use to generate man pages. On the way, we remove a few calls to
`strprintf()`, which became superficial after commit 32fbfda.
2018-08-04 16:17:13 +02:00
Pierre Rochard 3339d84535 [trivial] add doxygen-compatible comments to CAffectedKeysVisitor 2018-08-03 15:30:08 -04:00
Chun Kuan Lee bb6ca65f98 gui: get special folder in unicode 2018-08-04 02:47:58 +08:00
Chun Kuan Lee 1c5d225853 Drop boost::scoped_array 2018-08-04 01:11:42 +08:00
Russell Yanofsky 9c4dc597dd Use LOCK macros for non-recursive locks
Instead of std::unique_lock.
2018-08-03 07:11:37 -05:00
Russell Yanofsky 1382913e61 Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection
They should also work with any other mutex type which std::unique_lock
supports.

There is no change in behavior for current code that calls these macros with
CCriticalSection mutexes.
2018-08-03 07:11:37 -05:00
Russell Yanofsky ba1f095aad MOVEONLY Move AnnotatedMixin declaration
Move AnnotatedMixin closer to where it's used, and after the DEBUG_LOCKORDER
function declarations so it can call them.
2018-08-03 07:11:37 -05:00
Russell Yanofsky 41b88e9337 Add unit test for DEBUG_LOCKORDER code 2018-08-03 07:11:37 -05:00
Ben Woosley 384273260a
test: Add testing of value_ret for SelectCoinsBnB
Fix that the early bailout optimization tests did not test the actual
selection because their utxo pool was polluted by the make_hard_case test
preceding.
2018-08-03 02:45:20 -04:00
Pierre Rochard 909f54c80a [wallet] Add wallet name to log messages
After multiple wallets became supported, wallet-related log messages
became ambiguous as to which wallet they were being emitted by.

fixes #11317
2018-08-02 12:09:39 -04:00
Varunram d5f745a5c7
trivial: correct typos 2018-08-02 21:27:17 +08:00
practicalswift dd777f3e12 Remove unused variable 2018-08-02 14:30:59 +02:00
practicalswift cdf4089457 Remove redundant assignments (dead stores) 2018-08-02 14:30:53 +02:00
Wladimir J. van der Laan e577669062
gui: Pull initial 017x translations from transifex
Tree-SHA512: 4372a0602587e2bfceae69e3c90726c5d4a9d34a934dac9d000a9611fa7fca51e9d0fbacaee60decbea09294e53f94259ddcef2b3f876fefa1fd9f8a4dc25188
2018-08-02 13:43:51 +02:00
Wladimir J. van der Laan 2c14c1fa2f
Merge #13791: gui: Reject dialogs if key escape is pressed
7bf22bf0c2 gui: Reject options dialog when key escape is pressed (João Barbosa)
4a43306a4f gui: Reject edit address dialog when key escape is pressed (João Barbosa)
f7a553177d gui: Add GUIUtil::ItemDelegate with keyEscapePressed signal (João Barbosa)

Pull request description:

  Currently `EditAddressDialog` and `OptionsDialog` don't close when the escape key is pressed. The `QDataWidgetMapper` instances prevents closing the dialogs because the escape key is used to reset the widgets values. More details and workarounds in https://stackoverflow.com/a/51487847 and http://qtramblings.blogspot.com/2010/10/qdatawidgetmapper-annoyances.html.

  The adopted solution is different from the above references. It turns out that `QDataWidgetMapper::setItemDelegate` sets the event filter for all mapped widgets. So in this PR the mapper's delegate are changed to a custom `GUIUtil::ItemDelegate` that offers the signal `keyEscapePressed`, which is connected to the `QDialog::reject` slot.

  Note that the installed event filter lets all events pass, so the current behaviour isn't changed, meaning that widgets values are reset in addition to closing the dialog.

Tree-SHA512: 9c961d488480b4ccc3880a11a8f1824b65f77570ee8918c7302c62775a1a73e52ae988a31a55ffff87b4170ddbecf833c2f09b66095c00eb6854a4d43f030f1f
2018-08-02 12:59:39 +02:00
Wladimir J. van der Laan d3325b02e4
Merge #13844: doc: correct the help output for -prune
312ff01ee5 -prune option -help output aligned with code (Hennadii Stepanov)

Pull request description:

  The -help output for -prune is aligned with the code.

  In the code (.../src/init.cpp#L1063):
  ```
          if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {
              return InitError(strprintf(_("Prune configured below the minimum of %d MiB.  Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
          }
  ```
  So correct value of nPruneTarget is **greater than or equal to** MIN_DISK_SPACE_FOR_BLOCK_FILES.

Tree-SHA512: 8e55aa99c8f5a9d020677b0f1b016215e2dbda5fa4ee7c8504b12a3abef226bc21beca118fa332c0bf206a4aff913a5a717b55bb5b2ecdba38423e9c0161209e
2018-08-02 12:00:57 +02:00
Wladimir J. van der Laan aa30e4bb8f
Merge #13824: doc: Remove outdated net comment
fa365021bb doc: Remove outdated net comment (MarcoFalke)

Pull request description:

  `mapAddresses` and the corresponding "critsect" has been removed in 5fee401fe1 more than 6 years ago. Now is probably a good time to remove this confusing comment.

Tree-SHA512: 498a403d5703da395c18a7ebb776aa6e693e59fe43a839fefd261e0a5af58621763813979d4cfbd8d1728ce73b325b82002e393cde79bdbff33e0fbf68ab6747
2018-08-02 10:07:11 +02:00
Wladimir J. van der Laan c1cba35725
Merge #13835: [trivial,doc] Fix memory consistency model in comment
fe7180c5b2 [trivial,doc] Fix memory consistency model in comment (Jesse Cohen)

Pull request description:

  Updating a comment overlooked during review in #13247

Tree-SHA512: 0bd54ba1c265fdd77fd6e12ad0be46dd422348f7d926ce9abaca53fdb3a3c55c0d1cd90b4382321352076f4a81e2249c0014cd789f47a3637cb93bd983cb4657
2018-08-02 10:05:46 +02:00
Hennadii Stepanov 312ff01ee5
-prune option -help output aligned with code
see: .../src/init.cpp#L1063
2018-08-02 01:16:41 +03:00
Wladimir J. van der Laan f030410e88
Merge #13697: Support output descriptors in scantxoutset
f6b7fc349c Support h instead of ' in hardened descriptor paths (Pieter Wuille)
fddea672eb Add experimental warning to scantxoutset (Jonas Schnelli)
6495849bfd [QA] Extend tests to more combinations (Pieter Wuille)
1af237faef [QA] Add xpub range tests in scantxoutset tests (Jonas Schnelli)
151600bb49 Swap in descriptors support into scantxoutset (Pieter Wuille)
0652c3284f Descriptor tests (Pieter Wuille)
fe8a7dcd78 Output descriptors module (Pieter Wuille)
e54d76044b Add simple FlatSigningProvider (Pieter Wuille)
29943a904a Add more methods to Span class (Pieter Wuille)

Pull request description:

  As promised, here is an implementation of my output descriptor concept (https://gist.github.com/sipa/e3d23d498c430bb601c5bca83523fa82) and integration within the `scantxoutset` RPC that was just added through #12196.

  It changes the RPC to use descriptors for everything; I hope the interface is simple enough to encompass all use cases. It includes support for P2PK, P2PKH, P2WPKH, P2SH, P2WSH, multisig, xpubs, xprvs, and chains of keys - combined in every possible way.

Tree-SHA512: 63b54a96e7a72f5b04a8d645b8517d43ecd6a65a41f9f4e593931ce725a8845ab0baa1e9db6a7243190d8ac841f6e7e2f520d98c539312d78f7fd687d2c7b88f
2018-08-01 20:06:17 +02:00
Sjors Provoost d795c610d3
[qt] TransactionView: highlight replacement tx after fee bump 2018-08-01 18:43:46 +02:00
Jesse Cohen fe7180c5b2 [trivial,doc] Fix memory consistency model in comment 2018-08-01 12:19:45 -04:00
MarcoFalke c88529a178
Merge #13805: [wallet] Correctly limit output group size
a13647b8bd [qa] Add test for too-large wallet output groups (Suhas Daftuar)
57ec1c97b2 [wallet] correctly limit output group size (Suhas Daftuar)

Pull request description:

  Also add a test to ensure that output groups are being limited, even if a wallet has many outputs corresponding to the same scriptPubKey (the test fails without the first commit).

Tree-SHA512: 2aaa82005b0910488f5cbf40690d4c5e2f46949e299ef70b4cb6e440713811443d411dcbc6d71b1701fd82423073125e21747787d70830cd021c841afb732d51
2018-08-01 12:03:20 -04:00
MarcoFalke e83d82a85c
Merge #13247: Add tests to SingleThreadedSchedulerClient() and document the memory model
cbeaa91dbb Update ValidationInterface() documentation to explicitly specify threading and memory model (Jesse Cohen)
b296b425a7 Update documentation for SingleThreadedSchedulerClient() to specify the memory model (Jesse Cohen)
9994d01d8b Add Unit Test for SingleThreadedSchedulerClient (Jesse Cohen)

Pull request description:

  As discussed in #13023 I've split this test out into a separate pr

  This test (and documentation update) makes explicit the guarantee (previously undefined, but implied by the 'SingleThreaded' in `SingleThreadedSchedulerClient()`) - that callbacks pushed to the `SingleThreadedSchedulerClient()` obey the single threaded model for memory and execution - specifically, the callbacks are executed fully and in order, and even in cases where a subsequent callback is executed by a different thread, sequential consistency of memory for all threads executing these callbacks is maintained.

  Maintaining memory consistency should make the api more developer friendly - especially for users of the validationinterface. To the extent that there are performance implications from this decision, these are not currently present in practice because all use of this scheduler happens on a single thread currently, furthermore the lock should guarantee consistency across callback executions even when callbacks are executed by multiple threads (as the test does).

Tree-SHA512: 5d95a7682c402e5ad76b05bc9dfbca99ca64105f62ab9e78f6fc0f6ea8c5277aa399fbb94298e35cc677b0c2181ff17259584bb7ae230e38aa68b85ecbc22856
2018-07-31 20:52:05 -04:00
MarcoFalke fa365021bb
doc: Remove outdated net comment 2018-07-31 17:02:42 -04:00
MarcoFalke 0fb9c87815
Merge #13822: bench: Make CoinSelection output groups pass eligibility filter
494634a052 bench: Make CoinSelection output groups pass eligibility filter (Andrew Chow)

Pull request description:

  Set the depth of the output groups used in the CoinSelection benchmark to be 6 in order to pass the eligibility filter for the benchmark.

  Fixes #13813

Tree-SHA512: 55fc6aeda0127f5e155efb982aec211b70dfd3257808dce627886af6866ffa25de4df3c9b10f8c45b6c298a42542c54654f36e59efb208e9055885361f0e501c
2018-07-31 15:24:33 -04:00
Wladimir J. van der Laan 7d3623794a
Merge #13776: net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...)
2fb0066b99 net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...) (practicalswift)

Pull request description:

  Add missing verification of IPv6 address in `CNetAddr::GetIn6Addr(...)`.

Tree-SHA512: 8b0681252eec9cf293a2043e99fdacec520e321b477d8aca1cbd6327b85bf6c5e8cd820fb914f097c62655947e88745ebccd824a78b995a8186e910e6fe520aa
2018-07-31 20:47:40 +02:00
Andrew Chow 494634a052 bench: Make CoinSelection output groups pass eligibility filter
Set the depth of the output groups used in the CoinSelection benchmark
to be 6 in order to pass the eligibility filter for the benchmark.
2018-07-31 11:31:07 -07:00
MarcoFalke 230652cafc
Merge #13799: Ignore unknown config file options; warn instead of error
247d5740d2 Ignore unknown config file options for now (Pieter Wuille)
04ce0d88ca Report when unknown config file options are ignored (Pieter Wuille)

Pull request description:

  As reported by @satwo on IRC a few days ago, the current mechanism of treating unknown config file options as errors is problematic for options like `-rpcclienttimeout` which aren't defined for `bitcoind`.

  A full solution would be to either make all binaries be aware of each other's options, or to permit config file options that only apply to specific binaries (`bitcoind`, `bitcoin-qt`, `bitcoin-cli`). Both of these seem too invasive to introduce for 0.17.

  As a compromise, this PR makes it ignores those options, but still warn about it in the log file.

Tree-SHA512: dfddc771b91df3031a9c98d9f3292f8f4fcd1b97ebb7317b2f457e12d9f205dc63f42721302e7258dbb53f273d7cc041a65a0a9120972769555784e1f1cc9aef
2018-07-31 12:17:55 -04:00
Wladimir J. van der Laan 8ce55df70d
Merge #13794: chainparams: Update with data from assumed valid chain
fa8f2d826c doc: Fix chainTxData comment (MarcoFalke)
fa6094f152 chainparams: Update with data from assumed valid chain (MarcoFalke)

Pull request description:

  Can be reviewed by using the `getblock` and `getchaintxstats` rpcs of a synced node. Reviewers get extra points when their full node has checkpoints and assumevalid disabled.

Tree-SHA512: cedd61fde129ae4c16fc12275b61e4c5659b6d72dd801c608efc294188561bc986d94652fe9bea71ada48654258e2a074d2d2da78036c69608ccff3a6cc1ccf5
2018-07-31 06:53:09 +02:00
Pieter Wuille 247d5740d2 Ignore unknown config file options for now 2018-07-30 18:01:20 -07:00
Jesse Cohen cbeaa91dbb Update ValidationInterface() documentation to explicitly specify threading and memory model 2018-07-30 19:41:59 -04:00
Jesse Cohen b296b425a7 Update documentation for SingleThreadedSchedulerClient() to specify the memory model 2018-07-30 19:41:59 -04:00
João Barbosa 7bf22bf0c2 gui: Reject options dialog when key escape is pressed 2018-07-30 23:13:04 +01:00