Commit graph

19220 commits

Author SHA1 Message Date
Sjors Provoost 74ce326831
[test] Travis: enforce Python 3.4 support in functional tests
Make lint/check-doc.py Python 3.4 compatible.

Also add .python-version for pyenv which will cause tests with too
modern syntax to fail on developer machine rather than on Travis.
2018-12-12 10:39:32 +01: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
MarcoFalke fa30a0e7f7
test: mempool_persist: Verify prioritization is dumped correctly 2018-12-11 20:47:36 -05:00
MarcoFalke fa3e874d69
test: pruning: Check that verifychain can be called when pruned 2018-12-11 19:09:06 -05:00
Emil Engler 9b51b158fc Add nice table to files.md
Update files.md

Fix linting issue

Return to unix line endings

Update files.md

Fix trailing whitespaces

Add backtick quotes

Just one backtick
2018-12-11 22:24:09 +01:00
MarcoFalke f65bce858f
Merge #14886: [tests] Refactor importmulti tests
ee3b21dccb [tests] Add docstring for wallet_importmulti.py (John Newbery)
fbdba40594 [tests] add test_address method to wallet_import.py (John Newbery)
fd3a02c381 [tests] add test_importmulti method to wallet_import.py (John Newbery)
08a4a0f70f [tests] add get_multisig function to wallet_importmulti.py (John Newbery)
7c99614b40 [tests] add get_key function to wallet_importmulti.py (John Newbery)
e5a8ea8f14 [tests] tidy up imports in wallet_importmulti.py (John Newbery)
cb41ade6b1 [tests] fix flake8 warnings in wallet_importmulti.py (John Newbery)

Pull request description:

  https://github.com/bitcoin/bitcoin/pull/14565 needs test coverage. This PR refactors wallet_importmulti.py to the following pattern:

  1. Add `get_key()` and `get_multisig()` methods, which generate keys on node0 and return the priv/pubkeys and all scriptPubKey and address variants.
  2. Add `test_importmulti()` method, which takes an importmulti request, sends it to node1 and tests against success and error codes/messages.
  3. Add `test_address()` method, which takes an address, sends it as a getaddressinfo request to node1 and tests the values returned.

  This does not add any specific testing for #14565, but makes it very straightforward to add that testing: `test_importmulti()` can be easily updated to test for returned warnings, and `test_address()` can be called multiple times against the different address variants for a singlesig/multisig.

Tree-SHA512: e0ae9d3436f0b4eec4f6b9bdc0f02aef49c5a16bbac319fd47b2cfcaf01d01780d7b296280e8760686a57fac63275eec09e2959d8aaeceae1b406d8eff768435
2018-12-11 13:56:38 -05:00
MarcoFalke 7701b62561
Merge #14857: wallet_keypool_topup.py: Test for all keypool address types
0dcac51049 wallet_keypool_topup.py: Test for all keypool address types (Gregory Sanders)

Pull request description:

  To protect against regressions if key scanning is changed.

Tree-SHA512: d1c4bb033bafd97203a3f68fb262a501442be947907d67902f0391fbdec39c095196403c7675e602806cc68d7e2d1f552ab339a58346162379978d06dad1c4bb
2018-12-11 13:45:24 -05:00
MarcoFalke d680ef9381
Merge #14883: add --retry 5 to curl opts in install_db4.sh
522b80b33f add `--retry 5` to curl opts in install_db4.sh (qubenix)

Pull request description:

  I ran into some network issue that caused the clang patch to not download and the script exited. A retry would have solved it. The fallback choice, `wget`, has a default 20 retries.

  I chose 5 retries because `curl` backs of after each try, starting at one second and doubling each time. 5 retries means that worst case scenario would be a total of 31 seconds waiting between attempts. IMO that should be enough tries if internet is working, but not too much if internet is not working.

Tree-SHA512: ff48e1f8a9d39b9c6fabc616223974f46fadc5a1b30793cdaaf5ea4ce79f7c76efd259bfa9e81a5a7a7cff60b7133d89448faa3f86cc2f9b0c5ac9adf8dd2a9b
2018-12-11 13:43:20 -05:00
MarcoFalke aaaa8eb1ed
test: consensus: Check that final transactions are valid 2018-12-11 13:40:13 -05:00
MarcoFalke fae3617d79
test: Correctly deserialize without witness 2018-12-11 13:23:24 -05: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 d2ce315fbf [docs] add release note for change to GBT
GBT must now be called with the segwit rule.
2018-12-10 16:42:14 -05: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
John Newbery ee3b21dccb [tests] Add docstring for wallet_importmulti.py
Adds a docstring describing the new importmulti test.
2018-12-10 15:35:38 -05:00
John Newbery fbdba40594 [tests] add test_address method to wallet_import.py
Adds a new test_address method for testing the
imported addresses.
2018-12-10 15:35:36 -05:00
John Newbery fd3a02c381 [tests] add test_importmulti method to wallet_import.py
Adds a new test_importmulti method for testing the
importmulti RPC method.
2018-12-10 15:19:08 -05:00
John Newbery 08a4a0f70f [tests] add get_multisig function to wallet_importmulti.py
Adds a new get_multisig function which generates
a new multisig and returns the public keys,
private keys and all script and address types.
2018-12-10 15:17:28 -05:00
John Newbery 7c99614b40 [tests] add get_key function to wallet_importmulti.py
Adds a new get_key function which generates
a new key and returns the public key,
private key and all script and address types.
2018-12-10 15:17:26 -05:00
Daniel Ingram c9ba253f4f Add E711 to flake8 check 2018-12-10 15:12:09 -05:00
Daniel Ingram 17b55202da Compare to None with is/is not 2018-12-10 15:11:37 -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
fanquake b7bee6af76
doc: Update minimum required qt 2018-12-10 14:56:36 +08:00
MeshCollider e946fc7eb1
Merge #14809: Tools: improve verify-commits.py script
45842c3d2 Improve documentation for running verify-commits.py script (Jameson Lopp)

Pull request description:

  I ran into 3 different issues while trying to run the verify-commits script for the first time and I think documenting them would help save time for future developers.

  1. I was trying to just run it with "python" and didn't realize I had multiple python versions installed and this script is only syntactically valid for python 3.x.
  2. I needed to import the trusted keys
  3. The script was hanging because it was triggering my yubikey for signature verification

Tree-SHA512: dfc7a62972ca3de528fae3c9d420c7d2d6658767a555ebbf5f4a27c04748c35ccf8bf63bfc9f264358346de0db49bfbaf2d1540793a609d81c2d9b622ee8182c
2018-12-10 17:18:38 +13:00
Jonas Schnelli 89cdcfedca
Merge #14799: docs: convert link from http to https in doc/release-process.md
4ab638b79 http -> https (Dimitris Apostolou)

Pull request description:

Tree-SHA512: dc56aa3ddae478879c71af152a4383d892c6077104b137853af1a051ee6508686772516f5608ac0dcaecd2d48e84d9dab5f92ce4e544a3c2bec9fab3f6af0eb5
2018-12-09 23:57:49 +01:00
Daniel Ingram 1b89074ae2 Change '== None' to 'is None' 2018-12-09 15:55:13 -05:00
Daniel Ingram 16d2937723 Handle exception as ImportError 2018-12-09 15:49:34 -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
MarcoFalke 2753285be7
Merge #14788: tests: Possible fix the permission error when the tests open the cookie file
d6b3790d1a tests: check readability of cookie file (Chun Kuan Lee)

Pull request description:

  This PR would wait until the `.cookie` file is readable
  Possible fix no. 5 `PermissionError` in #14446

Tree-SHA512: e7055c7ca26a6eadbbe19e4eef08ffee61cd17de79b30af2f0d090f0ad81ca24815e3c7e034e5e30d47c580bb0b221b3955e9ff2fcec2274fbf7b9232ab0cdc7
2018-12-07 13:03:47 -05: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
MarcoFalke 9390217044
Merge #14795: test: allows test_runner command line to receive parameters for each test
5c40e7b91a test: allows test_runner command line to receive parameters for each test (marcoagner)

Pull request description:

  Fixes #14791.
  Seems to address the asked behaviour in a simple way, but could address more if a more complex behaviour is found to be needed (e.g. call `rpc_bind --ipv4` without the ".py" and have it added).

Tree-SHA512: d7e21dd0ada36dd97dac71196bb97702a92986b181beb3753e37e3294b899fb65129aff5f9a45fe92b06fbf7c74e605ccb87a422f874f7a85d30401f4c2228c8
2018-12-07 11:26:15 -05: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
MarcoFalke 23a1fa0248
Merge #14564: Adjust configure so that only bip70 is disabled when protobuf is missing instead of the GUI
58c5cc9ce7 Adjust configure so that only bip70 is disabled when protobuf is missing instead of the GUI (James Hilliard)

Pull request description:

  This change ensures that the GUI is still built even if protobuf is missing unless --enable-bip70 is passed to configure. If protobuf is present bip70 support will be compiled in unless --disable-bip70 is passed.

Tree-SHA512: 432d2fbefec5436503d8aa8994e4efaf760d88bfd5249af031b502b356852e8fd56362f86420f9ffe78498649079d0f1b68c327960b215d83c275800626ad275
2018-12-06 13:50:52 -05:00
John Newbery e5a8ea8f14 [tests] tidy up imports in wallet_importmulti.py 2018-12-06 12:18:52 -05:00
John Newbery cb41ade6b1 [tests] fix flake8 warnings in wallet_importmulti.py 2018-12-06 12:18:52 -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
MarcoFalke 4987cdd16d
Merge #14882: [doc] developer-notes.md: point out that UniValue deviates from upstream
a67d71311d [doc] developer-notes.md: point out that UniValue deviates from upstream (Sjors Provoost)

Pull request description:

  While debugging an issue I was somewhat surprised to [learn](https://github.com/bitcoin/bitcoin/pull/14164#issuecomment-419752678) that we've moved `src/univalue` from https://github.com/jgarzik/univalue to https://github.com/bitcoin-core/univalue, that these repos are both maintained and they're different.

  The first mention of using the bitcoin-core repo is from late 2015 in #7157. I didn't check when the last common ancestor commit is.

  I couldn't find documentation as to why (these things just happen in open source of course), but at minimum we should make this more clear.

  There's also the following line in `config.ac` that I'm not sure what to do with:
  ```
  AC_INIT([univalue], [1.0.3],
          [http://github.com/jgarzik/univalue/])
  ```

Tree-SHA512: e58105677b5ebe0005772282da4a805fee7dfccacfb1b2686a874517bf46072d1481181f8a8865d25526f6ed9e5fcd55d8d49906bf27cd0f5aefe4f258aa4d63
2018-12-06 11:33:39 -05: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