Commit graph

19471 commits

Author SHA1 Message Date
MeshCollider 9f48053d8f [wallet] Allow descriptor imports with importmulti 2019-02-05 19:42:04 +13:00
John Newbery d2b381cc91 [wallet] Refactor ProcessImport() to call ProcessImportLegacy()
This is almost entirely a move-only commit.

Reviewer hint: use --color-moved=zebra for review.
2019-02-05 19:41:24 +13:00
John Newbery 4cac0ddd25 [wallet] Add ProcessImportLegacy()
This commit adds a ProcessImportLegacy() function which
currently does nothing. It also unindents a block of
code for a future move-only change.

Reviewer hint: review with -w to ignore whitespace changes.
2019-02-05 19:41:24 +13:00
John Newbery a1b25e12a5 [wallet] Refactor ProcessImport()
This commit is move-only and doesn't make any functional changes. It
simply moves code around within ProcessImport() in preparation for
refactors in the next commits.
2019-02-05 19:41:24 +13:00
Wladimir J. van der Laan e50853501b
Merge #15347: Fix build after pr 15266 merged
e1b6436aad Fix build after pr 15266 merged (Hennadii Stepanov)

Pull request description:

  Ref: #15266

Tree-SHA512: 6647264c3e3d94f0f10dc3bed1b82dfe8ed1192906270b0bb79f4d018807e06cb42286c86ced7fee0e2b38284739657336672c5a30650b6473ffafd65c315349
2019-02-05 03:36:47 +01:00
Hennadii Stepanov e1b6436aad
Fix build after pr 15266 merged 2019-02-05 01:27:39 +02:00
MarcoFalke 452acee4da
Merge #15266: memory: Construct globals on first use
77777c5624 log: Construct global logger on first use (MarcoFalke)

Pull request description:

  The (de)initialization order is not well defined in C++, so generally it is not safe to use globals as the (de/con)structor of one global could use the (de/con)structor of another global before/after it has been (con/de)structed.

  Specifically this fixes:
  * `g_logger` might not be initialized on the first use, so do that. (Fixes #15111)

Tree-SHA512: eb9c22f4baf31ebc5b0b9ee6a51d1354bae1f0df186cc0ce818b4483c7b5a7f90268d2b549ee96b4c57f8ef36ab239dc6497f74f3e2ef166038f7437c368297d
2019-02-04 14:26:07 -05:00
Wladimir J. van der Laan bfbe42585e
Merge #15345: net: Correct comparison of addr count
107623c26c net: Correct comparison of addr count (Carl Dong)

Pull request description:

  `LOCAL_NONE` is supposed to be an enum indicating the `nScore` of a
  `LocalServiceInfo` rather than the count of an addr in `mapLocalHost`.

Tree-SHA512: a47a0859dd11c991d75b54e96b08c502e3d235f7a6522a2355053f377d05e7853483996919292f458d917a561b23951e6945d6bf0ff5a2f29513c477c640bdd2
2019-02-04 20:05:41 +01:00
Wladimir J. van der Laan 76deb30550
Merge #12255: Update bitcoin.service to conform to init.md
bad1716c6d init: Modify docs and add release note for 12255 (Carl Dong)
b0c7b54d0c init: Use systemd automatic directory creation (Carl Dong)

Pull request description:

  - `-datadir` option specified.
  - Ask systemd to create and set the right mode for PID directory, configuration directory, and data directory.
  - Tell systemd our group so it will set the right owner for aforementioned directories.

  More information: https://www.freedesktop.org/software/systemd/man/systemd.exec.html

Tree-SHA512: a6fad1efa2be433c1fdd863df3ff232736ed709a9e281f51a003b40987d8c213dc64a52bc13a19c85bf85680e78f0be112ecaf32ac274b1ff93bac84a1208845
2019-02-04 19:51:28 +01:00
Carl Dong 107623c26c net: Correct comparison of addr count
LOCAL_NONE is supposed to be an enum indicating the score of a
LocalServiceInfo rather than the count of an addr in mapLocalHost.
2019-02-04 13:12:20 -05:00
Wladimir J. van der Laan cf8aa5c76a
Merge #15339: qt: Pre-0.18 split-off translations update
df8a7d3408 qt: Pre-0.18 split-off translations update (Wladimir J. van der Laan)

Pull request description:

  - Update transifex slug
  - Mention update of MSVC build in `doc/translation_process.md`
  - Do a `make translate` to update English translations
  - Pull current translations from transifex

Tree-SHA512: 2f3102ff64167d5feaf484b2c45cd6aa1d06ac4f370107f0db5575fde023b3dfaea07e7178978bfff111fa80dbe4e56bd05b5774fc7c111b5273d33b3dcd44ad
2019-02-04 17:23:20 +01:00
MarcoFalke 70d06eb857
Merge #15328: travis: Revert "Run extended tests once daily"
fa6b7b9cf6 travis: Revert "Run extended tests once daily" (MarcoFalke)

Pull request description:

  Now that the extended tests are only pruning and dbcrash, both which are too long [1] to run on travis, we can revert this commit. All tests other than those two are still run for every travis pull request or cron run.

  [1] https://travis-ci.org/bitcoin/bitcoin/jobs/487615211#L2930

Tree-SHA512: dff293823336677380f6e804379125687869a4b547c968f0b6aae80daee1cbca2cfb845b63de7135f31fbe2383d8d7654694b6dc8a6a6b7d02d57ee8ff107527
2019-02-04 11:14:07 -05:00
MarcoFalke 6a5feb7d82
Merge #15325: msvc: Fix silent merge conflict between #13926 and #14372
bef8fdd6e2 msvc: Fix silent merge conflict between #13926 and #14372 (ken2812221)

Pull request description:

  The bitcoin-wallet.exe would have to link with libsecp256k1 after we build libsecp256k1 in project.

Tree-SHA512: cb3fafa301f39121f5d26ac8ac6009c9665fcad1061dbf14ba013104870abe5413ac57c97c97df12b6ba2ad709b776c51aeec20d41f3ae01d3460a5e18f40eec
2019-02-04 11:05:59 -05:00
Wladimir J. van der Laan df8a7d3408 qt: Pre-0.18 split-off translations update
- Update transifex slug
- Mention update of MSVC build in `doc/translation_process.md`
- Do a `make translate` to update English translations
- Pull current translations from transifex
2019-02-04 15:24:37 +01:00
Carl Dong bad1716c6d init: Modify docs and add release note for 12255 2019-02-04 09:18:28 -05:00
Wladimir J. van der Laan ebc6542d98
Merge #15322: wallet: Add missing cs_db lock
712d35bc56 wallet: Add missing cs_db lock (João Barbosa)

Pull request description:

  Without this lock `BerkeleyEnvironment::~BerkeleyEnvironment` and `GetWalletEnv` would race for `g_dbenvs`. This wasn't detected before because thread safety analysis does not check constructors
  and destructors.

  Reference: http://releases.llvm.org/5.0.2/tools/clang/docs/ThreadSafetyAnalysis.html#no-checking-inside-constructors-and-destructors

Tree-SHA512: 350cb2b991ca699a6bca85f87c82c38f0814484c8ccb0d7d83cb3bff9afcf60dd32b2a9554a9e72eb5803bfad8b6970fe7da618b39be5889178b86faa1b74124
2019-02-04 13:02:43 +01:00
Wladimir J. van der Laan 424327e1a8
Merge #15324: test: Make bloom tests deterministic
fae169c95e test: Make bloom tests deterministic (MarcoFalke)

Pull request description:

  non-deterministic tests are useless, since a failing test could not be reproduced unless the seed is known.

Tree-SHA512: 4f634ff0c6adf663444f1ac504f6dbceaa46b78d697b840531977ba30006453ac559d5c21cc3eaef6d92b87d46008a34b0db6331ea3318001987fcfaec634acf
2019-02-04 12:26:42 +01:00
Wladimir J. van der Laan 64127b3098
Merge #15280: gui: Fix shutdown order
0dd6a8c124 Check m_internals in UnregisterValidationInterface (João Barbosa)
fd6d499bda gui: Fix m_node.startShutdown() order (João Barbosa)
07b9aadcfc gui: Expose BitcoinGUI::unsubscribeFromCoreSignals (João Barbosa)
60e190ceb3 gui: Fix WalletController deletion (João Barbosa)

Pull request description:

  This PR consists in small fixes in order to have a clean shutdown from the GUI.

Tree-SHA512: a9c641f202bc810698c4a39d5c5a1f54e54bdab098c412d65418879e00764a9db9f38383813914d591e24e097e49f177942b2ae6c57bba05dcc095e8a1d0b8f4
2019-02-04 11:09:58 +01:00
João Barbosa 0dd6a8c124 Check m_internals in UnregisterValidationInterface
When a wallet is created it is registered in the validation interface (in
CWallet::CreateWalletFromFile) but it is not immediately added to the
wallets list. If a shutdown is requested before AddWallet (case more
evident when -rescan is set) then m_internals can be released (in
Shutdown -> UnregisterBackgroundSignalScheduler) before the wallet and
then ReleaseWallet would call UnregisterValidationInterface with
m_internals already released.
2019-02-03 22:23:44 +00:00
João Barbosa fd6d499bda gui: Fix m_node.startShutdown() order
This change forwards the shutdown request on the GUI (close the
application for instace) to the node as soon as possible. This way the
GUI doesn't have to wait for long operations to complete (rescan the
wallet for instance), instead those operations detect the shutdown
request and abort/interrupt.
2019-02-03 22:23:43 +00:00
João Barbosa 07b9aadcfc gui: Expose BitcoinGUI::unsubscribeFromCoreSignals
Move only change that makes unsubscribeFromCoreSignals public. It must be
called if the event loop is not running otherwise core signals handlers
can deadlock.
2019-02-03 22:23:43 +00:00
João Barbosa 60e190ceb3 gui: Fix WalletController deletion
The wallet controller instanced must be deleted after the window instance
since it is used there.
2019-02-03 22:23:43 +00:00
MarcoFalke 2fbf6a57d2
Merge #15330: test: Fix race in p2p_invalid_messages
fac3a054cb test: Fix race in p2p_invalid_messages (MarcoFalke)

Pull request description:

  After we change our magic bytes, the node may or may not send us messages such as feefilter or sendheaders, which would be rejected by `_on_data`.

  Solve that by replacing `_on_data` with a noop.

Tree-SHA512: bd25a81f0c6e31f09155e00abab8062777d827b9210d6a9b85ef35cfe5069338f100fecf058842f41a1f134fdb3cf7ac1fe80db493e4dab7988acdacb33149df
2019-02-02 20:02:25 -05:00
MarcoFalke fac3a054cb
test: Fix race in p2p_invalid_messages 2019-02-02 17:45:20 -05:00
MeshCollider 6e6b859f85
Merge #15263: Descriptor expansions only need pubkey entries for PKH/WPKH
11e0fd8d6 Descriptor expansions only need pubkey entries for PKH/WPKH (Pieter Wuille)

Pull request description:

  Currently, calling `Expand` on a `Descriptor` object will populate the output FlatSigningProvider with all public keys involved in the descriptor. This is overkill, as pubkey entries are only needed when the lookup of a public key based on its hash is desired (which is the case for `pkh`, `wpkh`, and `combo` descriptors).

  Fix this by pushing the population of pubkey entries down into the individual descriptor implementation's `MakeScript` function, instead of doing it generically.

  This should make it easier to implement #14491 without importing P2PKH outputs for the individual public keys listed inside a multisig.

Tree-SHA512: 5bc7e9bd29f1b3bc63514803e9489b3bf126bfc177d46313aa9eeb98770ec61a97b55bd8ad4e2384154799f24b1bc4183bfdb4708b2ffa6e37ed2601a451cabc
2019-02-03 10:52:39 +13:00
MarcoFalke fa6b7b9cf6
travis: Revert "Run extended tests once daily"
This reverts commit 88e3aa0bcb
2019-02-02 14:38:37 -05:00
MarcoFalke fae169c95e
test: Make bloom tests deterministic 2019-02-02 14:12:01 -05:00
MarcoFalke b3a715301a
Merge #15303: travis: Remove unused FUNCTIONAL_TESTS_CONFIG
facaae4cc4 travis: Save cache when compilation took very long (MarcoFalke)
faee6c9cac travis: Remove unused FUNCTIONAL_TESTS_CONFIG (MarcoFalke)

Pull request description:

  Closes #14163

Tree-SHA512: fb3dd0b7a0a3ee7ac1c6d4e9314239cd03ab4a11f04b6345ef4a1f50ea2b79ea4248c41e99a6fb923a4b1b477758c4fa665d56a4ab703acf5a58dbc7d852ffc4
2019-02-01 17:18:03 -05:00
ken2812221 bef8fdd6e2
msvc: Fix silent merge conflict between #13926 and #14372 2019-02-02 05:58:56 +08:00
João Barbosa 712d35bc56 wallet: Add missing cs_db lock
Without this lock BerkeleyEnvironment::~BerkeleyEnvironment and
GetWalletEnv would race for g_dbenvs. This wasn't detected before
because thread safety analysis does not check constructors and
destructors.
2019-02-01 21:13:08 +00:00
MarcoFalke facaae4cc4
travis: Save cache when compilation took very long 2019-02-01 15:20:00 -05:00
MarcoFalke 2c0867a181
Merge #15308: build: Restore compatibility with older boost
119d360aab travis: Document whether functional tests are run in the job name (Ben Woosley)
64f28545e3 Revert "travis: Compile trusty with depends for now" (Ben Woosley)
267eac00f9 Prefer boost::optional#get_value_or over #value_or (Ben Woosley)
1971f5ba04 Piecewise construct to avoid invalid construction (Ben Woosley)

Pull request description:

  In light of #14979, I realized that only qt 5.5+ was being tested under CI, while compatibility lists 5.2+.

  In #15276, Marco added Trusty to CI, building with depends. This changes that build to system libraries, in order to ensure ongoing compatibility with our claimed minimum required versions.

  Fixes #14983, previously open as #14998

Tree-SHA512: 6cff5e28c756ecb8bf797c8f6eb77c1944ba61a8dd6d7d4984e63eef384f6429dc79c505da3241c05b9c4db31c72b2a9846c7365aba9280f2e0620e5f3998d07
2019-02-01 13:05:30 -05:00
MarcoFalke 5c99bb0047
Merge #15247: qa: Use wallet to retrieve raw transactions
fa5278a419 qa: Use wallet to retrieve raw transactions (MarcoFalke)
fa2198328e qa: Style-only fixes in touched files (MarcoFalke)

Pull request description:

  Instead of asking the coin database and block storage about a transaction, pull it directly from the wallet in wallet related tests.

  This refactoring only makes sense in light of #15159.

  <sub>This product may contain minor stylistic cleanups

Tree-SHA512: ec34c7150d873da9f19fead3f7e3f758baba5ef10061942384c470a47a6f320690109be9c5160f0c8bc228272a729653d44c78471455337318f657d6c164ba23
2019-02-01 09:35:14 -05:00
Wladimir J. van der Laan 3e38d40873
Merge #15235: Do not import private keys to wallets with private keys disabled
e6c58d3b01 Do not import private keys to wallets with private keys disabled (Andrew Chow)
b5c5021b64 Refactor importwallet to extract data from the file and then import (Andrew Chow)
1f77f6754c tests: unify RPC argument to cli argument conversion and handle dicts and lists (Andrew Chow)

Pull request description:

  Fixes a bug where private keys could be imported to wallets with private keys disabled. Now every RPC which can import private keys checks for whether the wallet has private keys are disabled and errors if it is. Also added an belt-and-suspenders check to `AddKeyPubkeyWithDB` to have it assert that the wallet has private keys enabled.

Tree-SHA512: 5cd04febce9aa2bd9bfd02f312c6ff8705e37278cae59efd3895f6d6e2f1b477aefd297e2dd0860791bdd3d4f3cad8eb1a404f8f3d4e2035b91314ad2c1028ae
2019-02-01 14:01:32 +01:00
Ben Woosley 119d360aab
travis: Document whether functional tests are run in the job name 2019-01-31 22:13:45 -08:00
Ben Woosley 64f28545e3
Revert "travis: Compile trusty with depends for now"
Thus building against system rather than depends libs

This reverts commit fa5ce3f10e.
2019-01-31 22:10:55 -08:00
Ben Woosley 267eac00f9
Prefer boost::optional#get_value_or over #value_or
The latter is not defined in the earliest supported version of boost,
1.47.
https://www.boost.org/doc/libs/1_47_0/libs/optional/doc/html/boost_optional/detailed_semantics.html
https://travis-ci.org/bitcoin/bitcoin/jobs/486674823
2019-01-31 22:10:55 -08:00
Ben Woosley 1971f5ba04
Piecewise construct to avoid invalid construction
In CMainSignals::RegisterWithMempoolSignals running under Ubuntu 14.04
(QT 5.2), absent piecewise construction this fails to create the pair
because the argument is a connection, which is converted into a
non-copyable scoped_connection.

    validationinterface.cpp:80:186:   required from here
    /usr/include/boost/signals2/connection.hpp:234:7: error: ‘boost::signals2::scoped_connection::scoped_connection(const boost::signals2::scoped_connection&)’ is private
           scoped_connection(const scoped_connection &other);
           ^
    In file included from /usr/include/c++/4.8/utility:70:0,
                     from /usr/include/c++/4.8/algorithm:60,
                     from ./prevector.h:13,
                     from ./script/script.h:10,
                     from ./primitives/transaction.h:11,
                     from ./validationinterface.h:9,
                     from validationinterface.cpp:6:
    /usr/include/c++/4.8/bits/stl_pair.h:134:45: error: within this context
      : first(std::forward<_U1>(__x)), second(__y) { }
https://travis-ci.org/bitcoin/bitcoin/jobs/473689141#L2172
2019-01-31 22:10:54 -08:00
MarcoFalke cb35f1d305
Merge #15301: tests: When testing with --usecli, unify RPC arg to cli arg conversion and handle dicts and lists
2e023419c5 tests: unify RPC argument to cli argument conversion and handle dicts and lists (Andrew Chow)

Pull request description:

  When running tests with --usecli, unify the conversion from argument objects to strings using a new function arg_to_cli(). This fixes boolean arguments when using named arguments.

  Also use json.dumps() to get the string values for arguments that are dicts and lists so that bitcoind's JSON parser does not become confused.

Tree-SHA512: 472bef3cd78410a8552fd342b1852bcd7c57721cfa9176b26bacda6b0791cc0b3758561a529c4117a7428242f98bb7d5482b2a2dcd06bea0ef2b15ae26183405
2019-01-31 17:29:26 -05:00
MarcoFalke 3b19d8e341
Merge #14372: msvc: build secp256k1 and leveldb locally
82dcacb822 msvc: build leveldb locally (Chun Kuan Lee)
52091066be msvc: build secp256k1 locally (Chun Kuan Lee)

Pull request description:

  In current MSVC build setup, the code depends on leveldb and secp256k1 that are installed from vcpkg which is not controlled by us. If we update our code, we have to wait for vcpkg port being merged.

  This PR move them from vcpkg to local branch to make it as same as autoconf.

  The leveldb changes is based on bitcoin-core/leveldb#14 and bitcoin-core/leveldb#18

Tree-SHA512: aa2cc1c3191e8d9cab23d555da4be296314c46d944f452c2ec6202b1779e4cc223b603e589b38196cd2c793a03a8bb0ba128cc66256b35a58c5e7bb358475206
2019-01-31 14:52:00 -05:00
Andrew Chow e6c58d3b01 Do not import private keys to wallets with private keys disabled 2019-01-31 14:29:28 -05:00
Andrew Chow b5c5021b64 Refactor importwallet to extract data from the file and then import
Instead of importing keys and scripts as each line in the file is
read, first extract the data then import them.
2019-01-31 14:29:28 -05:00
Wladimir J. van der Laan 4b6673d382
Merge #15299: Fix assertion in CKey::SignCompact
3617f11739 Fix assertion in CKey::SignCompact (João Barbosa)

Pull request description:

  Fixes #15286.

Tree-SHA512: b39b6f26f87cf1850b13f625ab6de963937b6ecb5b6d4ac4932134f0491a6c0fa61c6d6e6980e8b1770775578dc365fdd1b6ba426bba1f7c23430f68b3a2339a
2019-01-31 19:13:45 +01:00
Andrew Chow 2e023419c5 tests: unify RPC argument to cli argument conversion and handle dicts and lists
When running tests with --usecli, unify the conversion from argument objects to
strings using a new function arg_to_cli(). This fixes boolean arguments when
using named arguments.

Also use json.dumps() to get the string values for arguments that are dicts and
lists so that bitcoind's JSON parser does not become confused.
2019-01-31 12:37:33 -05:00
MarcoFalke faee6c9cac
travis: Remove unused FUNCTIONAL_TESTS_CONFIG 2019-01-31 12:11:15 -05:00
Wladimir J. van der Laan efb6ddef9c
Merge #11911: Free BerkeleyEnvironment instances when not in use
14bc2a17dd Trivial: add doxygen-compatible comments relating to BerkeleyEnvironment (Pierre Rochard)
88b1d956fe Tests: add unit tests for GetWalletEnv (Pierre Rochard)
f1f4bb7345 Free BerkeleyEnvironment instances when not in use (Russell Yanofsky)

Pull request description:

  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 @TheBlueMatt 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.

Tree-SHA512: 219d77a9e2268298435b86088f998795e059fdab1d2050ba284a9ab8d8a44961c9b5cf96e94ee521688108d23c6db680e3e3a999b8cb2ac2a8590f691d50668b
2019-01-31 18:05:24 +01:00
Chun Kuan Lee 82dcacb822 msvc: build leveldb locally 2019-02-01 00:28:50 +08:00
Chun Kuan Lee 52091066be msvc: build secp256k1 locally 2019-02-01 00:28:49 +08:00
MarcoFalke 252fd15add
Merge #13926: [Tools] bitcoin-wallet - a tool for creating and managing wallets offline
3c3e31c3a4 [tests] Add wallet-tool test (João Barbosa)
49d2374acf [tools] Add wallet inspection and modification tool (Jonas Schnelli)

Pull request description:

  Adds an offline tool `bitcoin-wallet-tool` for wallet creation and maintenance.

  Currently this tool can create a new wallet file, display information on an existing wallet, and run the salvage and zapwallettxes maintenance tasks on an existing wallet. It can later be extended to support other common wallet maintenance tasks.

  Doing wallet maintenance tasks in an offline tool makes much more sense (and is potentially safer) than having to spin up a full node.

Tree-SHA512: 75a28b8a58858d9d76c7532db40eacdefc5714ea5aab536fb1dc9756e2f7d750d69d68d59c50a68e633ce38fb5b8c3e3d4880db30fe01561e07ce58d42bceb2b
2019-01-31 11:07:51 -05:00
João Barbosa 3617f11739 Fix assertion in CKey::SignCompact 2019-01-31 15:00:56 +00:00