Commit graph

21152 commits

Author SHA1 Message Date
Hennadii Stepanov fb4b9f9e3b
scripted-diff: Use ArgsManager::DEBUG_ONLY flag
-BEGIN VERIFY SCRIPT-
sed -i 's/unsigned int flags, const bool debug_only,/unsigned int flags,/' src/util/system.h src/util/system.cpp
sed -i 's/ArgsManager::NONE, debug_only/flags, false/' src/util/system.cpp
sed -i 's/arg.second.m_debug_only/(arg.second.m_flags \& ArgsManager::DEBUG_ONLY)/' src/util/system.cpp
sed -i 's/ArgsManager::ALLOW_ANY, true, OptionsCategory::/ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src)
sed -i 's/ArgsManager::ALLOW_ANY, false, OptionsCategory::/ArgsManager::ALLOW_ANY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src)
-END VERIFY SCRIPT-
2019-07-27 15:05:14 +03:00
Hennadii Stepanov 1b4b9422ca
scripted-diff: Use Flags enum in AddArg()
-BEGIN VERIFY SCRIPT-
sed -i 's/const bool debug_only,/unsigned int flags, &/' src/util/system.h src/util/system.cpp
sed -i -E 's/(true|false), OptionsCategory::/ArgsManager::ALLOW_ANY, &/' $(git grep --files-with-matches 'AddArg(' src)
-END VERIFY SCRIPT-
2019-07-27 15:05:14 +03:00
Hennadii Stepanov 265c1b58d8
Add Flags enum to ArgsManager 2019-07-27 15:05:14 +03:00
Hennadii Stepanov e0d187dfeb
Refactor InterpretNegatedOption() function
- added args parameter
- renamed to InterpretOption()
- removed code duplication
2019-07-27 15:05:01 +03:00
Hennadii Stepanov e0e18a1017
refactoring: Check IsArgKnown() early 2019-07-27 14:51:50 +03:00
MeshCollider febf3a856b
Merge #15588: Log the actual wallet file version and no longer publicly expose the "version" record
35e60e790f Remove ReadVersion and WriteVersion (Andrew Chow)
b3d4f6c961 Log the actual wallet file version (Andrew Chow)
c88e87c3b2 Remove nFileVersion from CWalletScanState (Andrew Chow)

Pull request description:

  The wallet file version is stored in the "minversion" record, not the "version" record. However "version" is no longer used anywhere except to record the highest versioned client which has opened a wallet file (which is currently only used to check whether this was most recently opened by a 0.4.0 or 0.5.0rc1 client which had a broken wallet encryption implementation). Furthermore, "version" was logged to the debug.log which is confusing because it is not the actual wallet file version.

  This PR changes it so that this confusion largely no longer exists. The wallet file version logging is changed to use "minversion" and reading and writing the "version" record is no longer publicly exposed to prevent potential confusion about whether the actual file version is being read or written. Lastly, in the one place it is actually used, the variable name is changed from nFileVersion to last_client to better reflect what that record actually represents.

ACKs for top commit:
  jb55:
    ACK 35e60e7, I compiled locally as a quick sanity check.
  ryanofsky:
    utACK 35e60e790f. This code still pretty confusing, but a little simpler now. And the previous log statement was really misleading and useless compared to the new one here.
  meshcollider:
    Looks good, thanks! utACK 35e60e790f

Tree-SHA512: f782b2f215d07fbc9b806322bda8085445b81c02b65ca674a8c6a3e1de505a0abd050669afe0ead4778816144a1c18462e13930071cedb7227a058aeb39493f7
2019-07-27 22:45:31 +12:00
MeshCollider 1139e3cb76
Merge #16415: Get rid of PendingWalletTx class
4d94916f0d Get rid of PendingWalletTx class. (Russell Yanofsky)

Pull request description:

  No reason for this class to exist if it doesn't have any code to run in the destructor. e10e1e8db0 from https://github.com/bitcoin/bitcoin/pull/16208 recently removed the destructor code that would return an unused key if the transaction wasn't committed.

  This is just cleanup, there's no change in behavior.

ACKs for top commit:
  ariard:
    utACK 4d94916. Successfully built both `bitcoind` and `bitcoin-qt`. `PendingWalletTx` was only a wrapper to enforce call to `ReturnDestination` if `CommitTransaction` doesn't `KeepDestination` before.
  promag:
    ACK 4d94916f0d, refactor looks good to me.
  meshcollider:
    utACK 4d94916f0d

Tree-SHA512: f3f93d2f2f5d8f1e7810d609d881c1b1cbbaa8629f483f4293e20b3210292605e947bc4903fde9d2d8736277ca3bd6de182f7eac1e13515d5a327f2ebc130839
2019-07-27 22:35:32 +12:00
MeshCollider dfb7fd60f2
Merge #16402: Remove wallet settings from chainparams
fa4a605a4c Remove wallet settings from chainparams (MarcoFalke)

Pull request description:

  Feels a bit odd to have wallet setting in the chainparams, so remove them from there

ACKs for top commit:
  promag:
    ACK fa4a605a4c, missed s/2018/2019?
  practicalswift:
    utACK fa4a605a4c
  darosior:
    ACK fa4a605a4c

Tree-SHA512: 2b3a5ee85d36af290d7db80bed1339e3c684607f1ce61cc65c906726e9174e40325fb1f67a34d8780f2a61fa39a1785e7c3a1cef5b6d6c364f38db5300cdbe3a
2019-07-27 22:29:09 +12:00
MeshCollider c606e6fc53
Merge #15996: rpc: Deprecate totalfee argument in bumpfee
2f7eb772f6 Add RPC bumpfee totalFee deprecation test (Jon Atack)
a92d9ce8cf deprecate totalFee argument in bumpfee RPC call (Gregory Sanders)

Pull request description:

  totalFee argument is of questionable use, and should be removed in favor of feerate-based features.

  I first moved IsDeprecatedRPCEnabled because `bitcoin-wallet` doesn't link `libbitcoin_server`.

ACKs for top commit:
  ryanofsky:
    utACK 2f7eb772f6. Only change since last review is leaving IsDeprecatedRPCEnabled in its happy home, and switching to rpcEnableDeprecated instead. (Thanks!)
  jonatack:
    ACK 2f7eb772f6. Built locally, manually tested rpc bumpfee, help output ([gist](https://gist.github.com/jonatack/863673eacc02f9da39ff6d6712f9d837)), all tests pass. Travis failures appears to be unrelated, the [bitcoin builds are green](https://bitcoinbuilds.org/index.php?build=121).
  meshcollider:
    Code Review ACK 2f7eb772f6

Tree-SHA512: c97465205ee59575df37894bcbb6c4ecf8858dd8fe9d89503f9342b226768c1dcb553153bc9eb3055f7bf5eb41573e48b8efa57e083cd255793cbe5280f0026a
2019-07-27 22:22:03 +12:00
John Newbery 42a5e912ee [mempool] log correct messages when CPFP fails 2019-07-26 16:21:26 -04:00
MarcoFalke fac2e6a604
test: Fail early on disconnect in mininode.wait_for_* 2019-07-26 16:11:26 -04:00
MarcoFalke dbf4f3f86a
Merge #16301: Use CWallet::Import* functions in all import* RPCs
40ad2f6a58 Have importwallet use ImportPrivKeys and ImportScripts (Andrew Chow)
78941da5ba Optionally allow ImportScripts to set script creation timestamp (Andrew Chow)
94bf156f39 Have importaddress use ImportScripts and ImportScriptPubKeys (Andrew Chow)
a00d1e5ec5 Have importpubkey use CWallet's ImportScriptPubKeys and ImportPubKeys functions (Andrew Chow)
c6a8274247 Have importprivkey use CWallet's ImportPrivKeys, ImportScripts, and ImportScriptPubKeys (Andrew Chow)
fae7a5befd Log when an import is being skipped because we already have it (Andrew Chow)
ab28e31c95 Change ImportScriptPubKeys' internal to apply_label (Andrew Chow)

Pull request description:

  #15741 introduced `ImportPrivKeys`, `ImportPubKeys`, `ImportScripts`, and `ImportScriptPubKeys` in `CWallet` which are used by `importmulti`. This PR changes the remaining `import*` RPCs (`importaddress`, `importprivkey`, `importpubkey`, and `importwallet`) to use these functions as well instead of directly adding the imported items to the wallet.

ACKs for top commit:
  MarcoFalke:
    ACK 40ad2f6a58 (checked that behavior changes are mentioned in the commit body)
  ryanofsky:
    utACK 40ad2f6a58. Only change since last review is a tweaked commit message (mentioning label update in importpubkey commit)
  Sjors:
    ACK 40ad2f6a5. Those extra tests also pass.

Tree-SHA512: 910e3bbe20b6f8809a47b7293775db234125615d886c7fd99c194f4cdf00c765eb1e24b1799260f1213b98c88f9bbe696796f36087c182925e567d44e9194c98
2019-07-26 15:19:24 -04:00
Jon Atack 2f7eb772f6 Add RPC bumpfee totalFee deprecation test
Next steps: remove `totalFee` from the wallet_bumpfee functional tests.
2019-07-26 14:09:03 -04:00
Gregory Sanders a92d9ce8cf deprecate totalFee argument in bumpfee RPC call 2019-07-26 14:09:03 -04:00
João Barbosa a33936737f Exclude depends/Makefile in .gitignore 2019-07-26 18:24:52 +01:00
Wladimir J. van der Laan a54a12046e
Merge #16386: depends: disable unused Qt features
248e22bbc0 depends: disable unused Qt features (fanquake)

Pull request description:

  Related to #16354. Kept separate from #16370, because:

  > QT is a monster 😂 - dongcarl in #bitcoin-builds

  I've done some basic testing on `macOS 10.14` and `Debian 9.9` so far. Would be good to have someone test on Windows.

  I was thinking about adding some inline documentation, i.e info about where to find the lists of Qt features & libraries, as well as breaking the flags up so that it's clearer which libraries we are supplying, which we rely on Qt for etc. Could go towards addressing  some of`2` in #16354.

ACKs for top commit:
  sipsorcery:
    tACK 248e22bbc0 (Windows 10 test only)
  laanwj:
    ACK 248e22bbc0

Tree-SHA512: 2cdcea8d268de21d355a7625c4d352f65728df0b8d8cc0f396aca676f42099a819f95652dfbfc665c991ba12c52735c1e9b693df4b12e3ee178fd39356fba8e0
2019-07-25 22:15:52 +02:00
Suhas Daftuar bf3be5297a [qa] Ensure we don't generate a too-big block in p2sh sigops test 2019-07-25 14:43:30 -04:00
MarcoFalke fcc4025c12
Merge #16459: [qa] Fix race condition in example_test.py
d9ab0ffa38 [qa] Fix race condition in example_test.py (Suhas Daftuar)

Pull request description:

  There's a race between sending a getdata for a bunch of blocks with the node receiving those blocks from a peer, which could cause test failure.  Fix this.

ACKs for top commit:
  MarcoFalke:
    ACK d9ab0ffa38
  laanwj:
    ACK  d9ab0ffa38
  promag:
    ACK d9ab0ffa38.

Tree-SHA512: c891f209eb2492f44e47da52ee6df950ff874ae26d2739011aca940d1caff6cedbac032b6509adbed07044c14fd711ba9d4d0e35c0f70bb2691f2ea4a46672ed
2019-07-25 12:54:09 -04:00
Suhas Daftuar d9ab0ffa38 [qa] Fix race condition in example_test.py 2019-07-25 10:32:07 -04:00
Torkel Rogstad fa2f991fa2
doc: add note on precedence of options in bitcoin.conf 2019-07-25 09:57:57 +08:00
fanquake fe001925f8
Merge #16455: doc: Remove downgrading warning in release notes, per 0.18 branch
77773edf21 doc: Remove downgrading warning in release notes, per 0.18 branch (MarcoFalke)

Pull request description:

  Same as b702e3757e1d4158eb80edd2924af46e86be6a83 (on the 0.18 branch)

ACKs for top commit:
  jonatack:
    ACK 77773edf21
  fanquake:
    ACK 77773edf21

Tree-SHA512: 4d7e598dd739f930f1a712f8647dfc7514e9fdef501f91bc0ee86642aa260360dc560335cd0f16b38b88b2a6b9cfc2df10b6418a371cf02137285d893e1cea30
2019-07-25 09:44:09 +08:00
fanquake d5a54ce8f0
Merge #15305: [validation] Crash if disconnecting a block fails
a47df13471 [qa] Test disconnect block failure -> shutdown (Suhas Daftuar)
4433ed0f73 [validation] Crash if disconnecting a block fails (Suhas Daftuar)

Pull request description:

  If we're unable to disconnect a block during normal operation, then that is a
  failure of our local system (such as disk failure) or the chain that we are on
  (eg CVE-2018-17144), but cannot be due to failure of the (more work) chain that
  we're trying to validate.

  We should abort rather than stay on a less work chain.

  Fixes #14341.

ACKs for top commit:
  practicalswift:
    utACK a47df13471
  TheBlueMatt:
    utACK a47df13471. Didn't bother to review the test in detail, it looked fine. Debated whether invalidateblock should ever crash the node, but *not* crashing in the case of hitting a pruned block (which is the only change here) is clearly better, even if there are other cases I'd argue we should crash in.
  ryanofsky:
    utACK a47df13471. Only change since last review is new comment.
  promag:
    ACK a47df1347, it takes awhile to quit (RPC connection timeouts) but that's unrelated - hope to fix that soon.
  fanquake:
    ACK a47df13471

Tree-SHA512: 4dec8cef6e7dbbe513c138fc5821a7ceab855e603ece3c16185b51a3830ab7ebbc844a28827bf64e75326f45325991dcb672f13bd7baede53304f27289c4af8d
2019-07-25 09:05:22 +08:00
Antoine Riard 9bc8b28c1d refactor : use RelayTransaction in BroadcastTransaction utility
To do so, we also refactor RelayTransaction to take a txid
instead of passing a tx
2019-07-24 19:47:56 -04:00
MarcoFalke 77773edf21
doc: Remove downgrading warning in release notes, per 0.18 branch 2019-07-24 16:39:30 -04:00
MarcoFalke d960d5ca99
Merge #16362: Add bilingual_str type
753f7cccce scripted-diff: Make translation bilingual (Hennadii Stepanov)
7c45e14f2f Add bilingual message type (Hennadii Stepanov)
0b86e517ad Refactor out translation.h (Hennadii Stepanov)

Pull request description:

  This PR adds the `bilingual_str` struct and a `strprintf` overload:
  0626b8cbdf/src/tinyformat.h (L1066-L1067)

  Both new features allow bitcoin code to easily send dual translated and non-translated messages to the GUI and the logging framework.

  This PR is only a refactoring (has been split off the #16224 (see: https://github.com/bitcoin/bitcoin/pull/16224/#issuecomment-509718579)) and does not change behavior.

ACKs for top commit:
  MarcoFalke:
    ACK 753f7cccce
  ryanofsky:
    utACK 753f7cccce. Only change since last review is fixing lint error (double includes)

Tree-SHA512: 52b0654421d558e4775c0484d78be26319fe3db5118af9b0a9bdfbdaad53a3704f527a5d5aba1013a64560b9b6a0c3c4cf0a6782e49aa731e18d99de95220385
2019-07-24 14:07:05 -04:00
Hennadii Stepanov ffea41f530
Enable all tests in feature_config_args.py 2019-07-24 19:15:10 +03:00
Hennadii Stepanov 66f5c17f8a
Use CheckDataDirOption() for code uniformity
All other clients and tools use CheckDataDirOption() rather
fs::is_directory(GetDataDir(false)) for the first datadir check.
2019-07-24 18:54:52 +03:00
Hennadii Stepanov 7e33a18a34
Fix datadir handling in bitcoin-cli
This prevents premature tries to access or create the default datadir.
This is useful when the -datadir option is specified and the default
datadir is unreachable.
2019-07-24 18:54:46 +03:00
Hennadii Stepanov b28dada374
Fix datadir handling in bitcoin-qt
This prevents premature tries to access or create the default datadir.
This is useful when the -datadir option is specified and the default
datadir is unreachable.
2019-07-24 18:54:32 +03:00
Hennadii Stepanov 50824093bb
Fix datadir handling in bitcoind
This prevents premature tries to access or create the default datadir.
This is useful when the -datadir option is specified and the default
datadir is unreachable.
2019-07-24 18:45:02 +03:00
Hennadii Stepanov 740d41ce9f
Add CheckDataDirOption() function 2019-07-24 18:43:07 +03:00
Hennadii Stepanov c1f325126c
Return absolute path early in AbsPathForConfigVal
This prevents premature GetDataDir() calls, e.g., when config file is
not read yet.
2019-07-24 18:42:59 +03:00
Andrew Chow 40ad2f6a58 Have importwallet use ImportPrivKeys and ImportScripts
Behavior changes:
* An "Importing ..." line is logged for every key, even ones that are skipped
2019-07-24 11:42:46 -04:00
Andrew Chow 78941da5ba Optionally allow ImportScripts to set script creation timestamp
Behavior changes:
* scripts imported in importmulti that are not explicilty scriptPubKeys will have timestamps set for them
2019-07-24 11:42:46 -04:00
Andrew Chow 94bf156f39 Have importaddress use ImportScripts and ImportScriptPubKeys
Also removes the now unused ImportAddress and ImportScript from rpcdump.cpp

Behavior changes:
* No errors will be thrown when the script or key already exists in the wallet.
* If the key or script is already in the wallet, their labels will be updated.
2019-07-24 11:42:46 -04:00
Andrew Chow a00d1e5ec5 Have importpubkey use CWallet's ImportScriptPubKeys and ImportPubKeys functions
Behavior changes:
* If any scripts for the pubkey were already in the wallet, their timestamps will be set to 1 and label updated
2019-07-24 11:42:37 -04:00
Hennadii Stepanov 753f7cccce
scripted-diff: Make translation bilingual
-BEGIN VERIFY SCRIPT-
sed -i 's/inline std::string _(const char\* psz)/inline bilingual_str _(const char\* psz)/' src/util/translation.h
sed -i 's/return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;/return bilingual_str{psz, G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz};/' src/util/translation.h
sed -i 's/\b_("\([^"]\|\\"\)*")/&.translated/g' $(git grep --files-with-matches '\b_("' src)
echo Hard cases - multiline strings.
sed -i 's/"Visit %s for further information about the software.")/&.translated/g' src/init.cpp
sed -i "s/\"Only rebuild the block database if you are sure that your computer's date and time are correct\")/&.translated/g" src/init.cpp
sed -i 's/" restore from a backup.")/&.translated/g' src/wallet/db.cpp
sed -i 's/" or address book entries might be missing or incorrect.")/&.translated/g' src/wallet/wallet.cpp
echo Special case.
sed -i 's/_(COPYRIGHT_HOLDERS)/&.translated/' src/util/system.cpp test/lint/lint-format-strings.py
-END VERIFY SCRIPT-
2019-07-24 16:33:20 +03:00
Hennadii Stepanov 7c45e14f2f
Add bilingual message type 2019-07-24 16:33:20 +03:00
Hennadii Stepanov 0b86e517ad
Refactor out translation.h
This is a prerequisite for introducing bilingual error messages.
Note: #includes are arranged by clang-format-diff.py script.
2019-07-24 16:32:53 +03:00
MarcoFalke 0626b8cbdf
Merge #16445: test: Skip flaky p2p_invalid_messages test on macOS
c3dfc91032 test: Skip flaky p2p_invalid_messages test on macOS (Fabian Jahr)

Pull request description:

  This mitigates https://github.com/bitcoin/bitcoin/issues/15400

  I had a look into the issue today and this seems to be the best we can do given that the root causes some unexpected custom error code from the macOS kernel that python/asyncio doesn't know how to handle properly yet.

Top commit has no ACKs.

Tree-SHA512: 20a0551d45c405b6eb0ae58190b701c7026c52eff6c434bc678f723a4dabf0074e5b52a8bb3d51ee7132dc29419d1e67a24696761c444c62cd4d429ec768e67d
2019-07-24 07:18:45 -04:00
William Casarin 72eaab073b tests: functional watch-only wallet tests
These test the new watch-only defaults for rpcs with include_watchonly
and includeWatching options.

Signed-off-by: William Casarin <jb55@jb55.com>
2019-07-24 03:33:53 -07:00
William Casarin 72ffbdc579 doc: add release note for include_watchonly default changes
Signed-off-by: William Casarin <jb55@jb55.com>
2019-07-24 03:33:53 -07:00
fanquake 248e22bbc0
depends: disable unused Qt features 2019-07-24 09:50:31 +08:00
fanquake f509e3b8ce
doc: remove line numbers from qt package links 2019-07-24 09:17:48 +08:00
fanquake 1bb1661a40
doc: fix typo in bitcoin_qt.m4 comment 2019-07-24 09:17:47 +08:00
fanquake 0aeb98ac1f
build: remove jpeg lib check from bitcoin_qt.m4 2019-07-24 09:17:47 +08:00
fanquake 98a64bd296
build: disable libjpeg in qt 2019-07-24 09:17:40 +08:00
MarcoFalke 67923d6b3c
Merge #16366: init: Use InitError for all errors in bitcoind/qt
fa6f402bde Call node->initError instead of InitError from GUI code (Russell Yanofsky)
fad2502240 init: Use InitError for all errors in bitcoind/qt (MarcoFalke)

Pull request description:

  Using the same InitError for startup error in the daemon and the gui makes it possible to run the tests with the gui again:

  ```sh
  BITCOIND=bitcoin-qt ./test/functional/test_runner.py feature_includeconf feature_config_args

ACKs for top commit:
  hebasto:
    ACK fa6f402bde
  ryanofsky:
    utACK fa6f402bde. Only changes since last review are removing more includes and adding Node::initError method to avoid accessing node `InitError` function and global variables from GUI code.

Tree-SHA512: bd19e08dcea4019dfe40356bc5c63cb583cefed54b6c9dcfb82f1b5b00308d8e2b363549afcaea5e93bf83864dbe0917400c3b70f43a8a5bdff45c9cd34cc294
2019-07-23 18:40:46 -04:00
Fabian Jahr c3dfc91032 test: Skip flaky p2p_invalid_messages test on macOS 2019-07-23 15:59:27 -04:00
Hennadii Stepanov 4057b7acb7
wallet: Recognize -disablewallet option early 2019-07-23 15:38:10 +03:00