Commit Graph

2640 Commits

Author SHA1 Message Date
Andrew Chow 4f8704d57f Give an error and exit if there are unknown parameters
If an unknown option is given via either the command line args or
the conf file, throw an error and exit

Update tests for ArgsManager knowing args

Ignore unknown options in the config file for bitcoin-cli

Fix tests and bitcoin-cli to match actual options used
2018-05-30 11:27:50 -04:00
Wladimir J. van der Laan 3d4fa83587 Stop translating command line options
Many options are extremely technical, and refer internals, making it
difficult to translate usefully. This came up in discussion of e.g.
 #10949. If a message is not understood by translators (which are
typically end-users, not developers) they'll either translate it
literally, making it harder to understand instead of easier, with the
added drawback of the user no longer being able to google it.

Also the translation was only working for bitcoin-qt as with
the console programs, there is no translation backend. So it was
injecting never-used translation messages for bitcoin-cli, -tx.

For these reasons, stop translating options help completely. This should
not affect the output **in any way** except for bitcoin-qt when a
non-English language is configured in the locale.

This implements #10962.
2018-05-30 14:23:35 +02:00
Wladimir J. van der Laan 3fd0c2336a
Merge #13273: Qt/Bugfix: fix handling default wallet with no name
13c3a659c0 Qt/Bugfix: fix handling default wallet with no name (João Barbosa)

Pull request description:

  If one loads a wallet via RPC (`loadwallet w2`), then select w2, select back to the default wallet (which is an empty string), that default wallet cannot be access through the RPC console because the current code only points to the wallet endpoint if the wallet name is not empty.

  This is a quick fix that reenables accessing the default wallet in case an additional wallet has been loaded.

  Using "" for the default wallet may not be ideal in other cases and it may make more sense to change it at a deeper level (wallet.cpp). See discussion here which where the reasons for the current behaviour in master:
  https://github.com/bitcoin/bitcoin/pull/11687#issuecomment-370862718

  @jnewbery @promag @ryanofsky

Tree-SHA512: 74b935886b4e4a6033a2f5e1f44bb69a252e31f4021e19a2054445a8e3e4db1d8ee256290850a84d8569d2d0e21412fce0170e7f0e881259156057587181ee05
2018-05-29 15:24:26 +02:00
Wladimir J. van der Laan a315b79ad2
Merge #13275: Qt: use [default wallet] as name for wallet with no name
2885c131b6 Qt: use [default wallet] as name for wallet with no name (Jonas Schnelli)

Pull request description:

  Loading a wallet from a state where only the default wallet was active results in using an empty string for the initial/default wallet name.

  This is a GUI only quick-fix that overrides wallet(s) with name "" to "[default wallet]". Does not affect `getwalletinfo` or `listwallets`.

  Also, unsure if it should be fixed at a deeper level and if – instead of [default wallet] – it should use `wallet.dat` (the filename of the default wallet).

Tree-SHA512: 1d50dbb200b23df5ac53ce15aeb6453af4da354d6e6e53fe33ff075b477493254d6028b6d3569a7804b1aa616cb9a988a53de818937e37cdcb19cb70a90e2a88
2018-05-28 17:10:36 +02:00
Wladimir J. van der Laan f8be434133
Merge #13284: gui: fix visual "overflow" of amount input.
5f3cbde9de Increased max width of amount field to prevent number overflow bug. (Brandon Ruggles)

Pull request description:

  Fixes #13231.

  I was able to reproduce this bug within my own Fedora 27 VM. Following @jonasschnelli's advice, I first tried to change `setAlignment(Qt::AlignRight);` to `setAlignment(Qt::AlignLeft);`, however, I realized that this wouldn't fix the underlying overflow problem, as it would only make it easier to see the most significant digits under certain scenarios. The reason for the overflow is that Fedora uses plus and minus buttons on the Qt spin box class, rather than up and down arrows, which is what happens on **most** other operating systems. These plus and minus buttons take up more width, and therefore provide less space for text.

  The solution I went with was the second suggestion by @jonasschnelli, which was to just increase the maximum width of the amount box. After some experimentation, 240 seemed to be the smallest max width that would allow as many digits as one would want in the amount box without overflow, even with the plus and minus buttons in Fedora.

  Please let me know if there are any issues with this PR and I will work to fix them. Thank you!

Tree-SHA512: 155f34cec74af46ec1fe723a5241798d8e15607a4e1cdc493014dcc0ae9818a001c7901831168b5f26a6953ec5a992e4a67c57db1ad377bcf10f12941688ee93
2018-05-24 15:52:21 +02:00
João Barbosa 80b4910f7d wallet: Use shared pointer to retain wallet instance 2018-05-22 16:56:20 +01:00
Brandon Ruggles 5f3cbde9de Increased max width of amount field to prevent number overflow bug. 2018-05-20 01:09:16 -04:00
Jonas Schnelli 2885c131b6
Qt: use [default wallet] as name for wallet with no name 2018-05-19 11:24:40 +02:00
João Barbosa 13c3a659c0
Qt/Bugfix: fix handling default wallet with no name 2018-05-18 19:59:25 +02:00
Jonas Schnelli e54550303b
Merge #13097: ui: Support wallets loaded dynamically
2e7513471 fixup! ui: Support wallets loaded dynamically (João Barbosa)
0e674ba55 ui: Support wallets loaded dynamically (João Barbosa)
1c8fe0bf9 ui: Remove unnecessary variable fFirstWallet (João Barbosa)

Pull request description:

  Add support in the UI for wallets loaded dynamically.

Tree-SHA512: 4016d61580b31e28c49861b1cb0e77fac5417f9676a6ce6156be28cb6059fdf3d3dd4d57dbbc22a574ad428c2a4a3702aedca596a84e644ce148e1084feb29c9
2018-05-18 10:10:46 +02:00
Jonas Schnelli 2a7c53bc2a
Merge #13264: [qt] Satoshi unit
c722f00a7 [qt] Added satoshi unit "Satoshi (sat)" will be displayed in dropdowns and status bars. "sat" will be used when appended to numbers. (GreatSock)
4ddbcbf8c [qt] BitcoinUnits::format with zero decimals Formatting with zero decimals will now result in 123 instead of 123.0 (GreatSock)

Pull request description:

  This adds satoshi as an additional amount unit for the GUI.

Tree-SHA512: c166c96c9a434b6ac700e1628e54f2dbb132c5232d949c0b464f61276a91d56f9bab4a62d50780535f1d34eaac6484f693a1e0611cd7c9d1ed5ebee066c0dd08
2018-05-18 09:17:20 +02:00
João Barbosa 2e75134719 fixup! ui: Support wallets loaded dynamically 2018-05-18 00:46:44 +01:00
GreatSock c722f00a7e [qt] Added satoshi unit
"Satoshi (sat)" will be displayed in dropdowns and status bars.
"sat" will be used when appended to numbers.
2018-05-17 16:14:49 +02:00
GreatSock 4ddbcbf8c4 [qt] BitcoinUnits::format with zero decimals
Formatting with zero decimals will now result in 123 instead of 123.0
2018-05-17 15:50:09 +02:00
Luke Dashjr 82dda6bed9
GUI: Allow generating Bech32 addresses with a legacy-address default 2018-05-17 09:40:50 +08:00
Luke Dashjr 7ab1c6f6a7
GUI: Rephrase Bech32 checkbox text/tooltip
- "Bech32" isn't very user-friendly
- You don't spend from addresses
2018-05-17 09:31:35 +08:00
João Barbosa 0e674ba557 ui: Support wallets loaded dynamically 2018-05-16 20:48:48 +01:00
João Barbosa 1c8fe0bf90 ui: Remove unnecessary variable fFirstWallet 2018-05-16 20:48:48 +01:00
Cristian Mircea Messel 73cd5b25b9 [gui] Add proxy icon in statusbar 2018-05-15 23:23:56 +03:00
MarcoFalke 81c533c6f4
Merge #13158: [Qt]: Improve sendcoinsdialog readability
f08a385590 [qt]: changes sendcoinsdialog's box layout for improved readability. (marcoagner)

Pull request description:

  I'm addressing two (probably duplicate) issues: https://github.com/bitcoin/bitcoin/issues/11606 and https://github.com/bitcoin/bitcoin/issues/10613.

  Some points worth noting:

  - I've tried to balance the proposed changes on both issues without going too far and remaining a bit conservative. It will be easier to improve based on suggestions where necessary.

  - I preferred to maintain a layout that doesn't ask for an address truncation because, in my view, this wallet should be conservative on this.

  - I didn't follow the idea of aligning the amounts to the right for finding it more natural (and minimalist) to read the information without having to map alignments. Additionally, that approach seems to need more `<hr />`'s (or similar) in order to help the user to map information, which ended up cluttering the box too much (specially with multiple recipients). Thus, I preferred to just give some more space between recipients. Let me know if there are better ideas on this.

  Visually, I went from this (current):
  ![screenshot from 2018-05-03 15-11-30](https://user-images.githubusercontent.com/5016303/39581859-16abec82-4edc-11e8-86d3-eb722f8a7ed6.png)

  To this:
  ![screenshot from 2018-05-03 15-15-41](https://user-images.githubusercontent.com/5016303/39582066-96856adc-4edc-11e8-804c-468aec44cc8d.png)

  As a side note, while doing this, I thought about a better way to show fees and found there's already a PR on this (https://github.com/bitcoin/bitcoin/pull/12189) and thought it is

Tree-SHA512: e94b740fab6c1babd853a97be65c3b6f86ec174c975a926fde66b147f7a47e0cf0fa10f7255ba92aaba68c76a80dde8c688008179a34705a9799bf24d3c5cd46
2018-05-14 17:07:26 -04:00
Wladimir J. van der Laan e03c0db08f
Merge #12560: [wallet] Upgrade path for non-HD wallets to HD
a8da482 Bump wallet version for pre split keypool (Andrew Chow)
dfcd9f3 Use a keypool of presplit keys after upgrading to hd chain split (Andrew Chow)
5c50e93 Allow -upgradewallet to upgradewallets to HD (Andrew Chow)
2bcf2b5 Test sethdseed (Andrew Chow)
b5ba01a Add 'sethdseed' RPC to initialize or replace HD seed (Chris Moore)
dd3c07a Separate HaveKey function that checks whether a key is in a keystore (Andrew Chow)

Pull request description:

  Revival/rebase of #11085

  Adds a new command `sethdseed` which allows you to either set or generate a new HD seed to be used. A new keypool can be generated or the original one kept and new keys added to the keypool will come from the new HD seed.

  Wallets that are not HD will be upgraded to be version FEATURE_HD_SPLIT when the `sethdseed` RPC command is used.

  I have also add some tests for this.

  Additionally `-upgradewallet` can now be used to upgrade a wallet from non-HD to HD. When it is used for such an upgrade, the keypool will be regenerated.

Tree-SHA512: e56c792e150590429ac4a1061e8d6f7b20cca06366e184eb9bbade4cd6ae82699a28fe84f87031eadba97ad2c1606517a105f00fb7b45779c979243020071adb
2018-05-14 11:17:29 +02:00
Chris Moore b5ba01a187 Add 'sethdseed' RPC to initialize or replace HD seed 2018-05-12 13:15:21 -04:00
Andrew Chow 4d4185a4f0 Make gArgs aware of the arguments
gArgs knows what the available arguments are and their help. Getting
the help message is moved to gArgs and HelpMessage() is removed
2018-05-09 12:21:05 -04:00
Wladimir J. van der Laan 7b966d9e6e
Merge #10267: New -includeconf argument for including external configuration files
25b7ab9 doc: Add release notes for -includeconf (Karl-Johan Alm)
0f0badd test: Test includeconf parameter. (Karl-Johan Alm)
629ff8c -includeconf=<path> support in config handler, for including external configuration files (Karl-Johan Alm)

Pull request description:

  Fixes: #10071.

  Done:
  - adds `-includeconf=<path>`, where `<path>` is relative to `datadir` or to the path of the file being read, if in a file
  - protects against circular includes
  - updates help docs

  ~~~Thoughts:~~~
  - ~~~I am not sure how to test this in a neat manner. Feedback on this would be nice. Will dig/think though.~~~

Tree-SHA512: cb31f1b2f69fbc0890d264948eb2e501ac05cf12f5e06a5942f9c1539eb15ea8dc3cae817f4073aecb2fcc21d0386747f14f89d990772003a76e2a6d25642553
2018-05-09 06:36:54 +02:00
marcoagner f08a385590 [qt]: changes sendcoinsdialog's box layout for improved readability.
[qt]: extracts html tags from translator.

[qt]: removes missed tr() call.
2018-05-08 21:19:12 +01:00
Wladimir J. van der Laan 979150bc23
Merge #12729: Get rid of ambiguous OutputType::NONE value
1e46d8a Get rid of ambiguous OutputType::NONE value (Russell Yanofsky)

Pull request description:

  Based on suggestion by @sipa https://github.com/bitcoin/bitcoin/pull/12119#issuecomment-357982763

  After #12119, the NONE output type was overloaded to refer to either an output type that couldn't be parsed, or to an automatic change output mode.  This change drops the NONE enum and uses a simple bool to indicate parse failure, and a new CHANGE_AUTO enum to refer the change output type.

  This change is almost a pure refactoring except it makes RPCs reject empty string ("") address types instead of treating them like they were unset. This simplifies the parsing code a little bit and could prevent RPC usage mistakes. It's noted in the release notes.

  Follows up #12408 by @MarcoFalke

  Followups for future PRs:

  - [ ] Add explicit support for specifying "auto" in `ParseOutputType` as suggested by promag and sipa: https://github.com/bitcoin/bitcoin/pull/12729#issuecomment-374799567 and https://github.com/bitcoin/bitcoin/pull/12729#discussion_r175969481
  - [ ] Add wallet `AddressChangeType` method to complement `TransactionChangeType`:  https://github.com/bitcoin/bitcoin/pull/12729#discussion_r175969618.

Tree-SHA512: 8b08b272bcb177a0a9e556dcd965840a7fe601ef83ca97938b879c9b1a33b5b3f96939e1bceef11ba7c644ac21bfd6c1dbc6ca715cd1da4ace50475240e4ee48
2018-05-03 11:53:30 +02:00
Wladimir J. van der Laan ef006d9284
Merge #12928: qt: Initialize non-static class members that were previously neither initialized where defined nor in constructor
3fdc5fe Make sure initialization occurs in the constructor (practicalswift)
1e7813e Remove redundant initializations from the constructor (practicalswift)
f131872 Initialize non-static class members where they are defined (practicalswift)
73bc1b7 Initialize editStatus and autoCompleter. Previously not initialized where defined or in constructor. (practicalswift)

Pull request description:

  Initialize variables previously neither defined where defined nor in constructor:
  * `editStatus`
  * `autoCompleter`

  Also; initialize non-static class members where they are defined in accordance with developer notes.

Tree-SHA512: 84f0cb87ec8394ed7641bfa0731be2ec72e6a920e00ae206ff89e2e7c960358f603c52878311b24601a33aa7cba6ea4f9a78a8ade88112dea0f41efb08e84e25
2018-05-02 16:49:59 +02:00
practicalswift 3fdc5fee18 Make sure initialization occurs in the constructor 2018-05-02 13:56:20 +02:00
marcoagner 12ad33a8e4
[doc] qt: fixes broken link on readme 2018-05-01 21:17:54 +01:00
Karl-Johan Alm 629ff8c358
-includeconf=<path> support in config handler, for including external configuration files 2018-04-26 12:46:28 +09:00
James O'Beirne 5109fc4a9c [tests] [qt] Add tests for address book manipulation via EditAddressDialog
Also modifies corresponding QT code to allow for use within test cases.
2018-04-25 13:13:24 -04:00
James O'Beirne 9c01be1b85 [tests] [qt] Introduce qt/test/util with a generalized ConfirmMessage
ConfirmMessage is reused in future tests apart from its single usage here.
2018-04-25 13:08:53 -04:00
James O'Beirne 8cdcaee4c7 [qt] Display more helpful message when adding a send address has failed
Addresses #12796.

When we're unable to add a sending address to the address book because it
already exists as a receiving address, display a message indicating as much.
This should help avoid confusion about an address supposedly already in the
book but which isn't currently visible in the interface.
2018-04-25 13:08:53 -04:00
James O'Beirne c5b277033a Add purpose arg to Wallet::getAddress
Also make all arguments to getAddress required and document args at call sites.
2018-04-25 13:08:53 -04:00
Wladimir J. van der Laan 476cb35551
Merge #12909: wallet: Make fee settings to be non-static members
fac0db0 wallet: Make fee settings non-static members (MarcoFalke)

Pull request description:

  The wallet header defined some globals (they were called "settings"), that should be class members instead.

  This commit is hopefully only refactoring, apart from a multiwallet bugfix: Calling the rpc `settxfee` for one wallet, would set (and change) the fee rate for all loaded wallets. (See added test case)

Tree-SHA512: 4ab6ec2f5c714742396ded5e451ec3b1ceb771e3696492de29889d866de4365b3fbe4a2784d085c8b8bd11b1ebb8a1fec99ab2c62eee716791cfc67c0cf29e1b
2018-04-24 16:37:30 +02:00
MarcoFalke bdda14d1c0
Merge #13055: qt: Don't log to console by default
aee80b0ef9 qt: Don't log to console by default (Wladimir J. van der Laan)

Pull request description:

  Default `-printtoconsole` to false for the GUI. GUI programs should not print to the console unnecessarily. For example, when launched by the window manager, the output might end up in the X session log file,
  resulting in duplicate logging. On Windows, it is pointless as well because bitcoin-qt isn't a console application.

  This same mechanism is used to set `-server` to true by default for bitcoind: https://github.com/bitcoin/bitcoin/blob/master/src/bitcoind.cpp#L116

  (fixes #13004)

Tree-SHA512: 24ae460d9d97130a063f7bf7fa6da1e6cc46643a94ea0827aa64d0f4a80647e5e7394695b24ea0f49a147a1fa07329659d224f04511fc24b97a9869d1c29b890
2018-04-23 19:29:55 -04:00
Wladimir J. van der Laan 8609ddb368
Merge #12999: qt: Show the Window when double clicking the taskbar icon
67bf2aa qt:Show the entire Window when double clicking on taskbar (Chun Kuan Lee)

Pull request description:

  fix #12838

Tree-SHA512: 4498bc1fe52efeed3768d6bdd7941e4b036d52ae80d9c1b6679c6daa3a62aeda4cff0c91fe1c65afaea6049c59cb0296fdcbff63ecb342d518615a92361fda7f
2018-04-23 21:01:08 +02:00
MarcoFalke fac0db0ff8
wallet: Make fee settings non-static members 2018-04-23 10:49:21 -04:00
Wladimir J. van der Laan aee80b0ef9 qt: Don't log to console by default
Default `-printtoconsole` to false for the GUI. GUI programs should not
print to the console unnecessarily. For example, when launched by the
window manager, the output might end up in the X session log file,
resulting in duplicate logging. On Windows, it is pointless as well
because bitcoin-qt isn't a console application.
2018-04-23 09:25:34 +02:00
João Barbosa 373aee26c3 wallet: Add AddWallet, RemoveWallet, GetWallet and GetWallets
With these new functions all vpwallets usage are removed
and vpwallets is now a static variable (no external linkage).
2018-04-18 22:07:33 +01:00
Chun Kuan Lee 67bf2aa68e
qt:Show the entire Window when double clicking on taskbar 2018-04-17 02:38:10 +08:00
Jonas Schnelli 5f2a39946f
Merge #11200: Allow for aborting rescans in the GUI
ae1d2b030 Give an error when rescan is aborted by the user (Andrew Chow)
69b01e6f8 Add cancel button to rescan progress dialog (Andrew Chow)

Pull request description:

  A cancel button is added to the `showProgress` dialog that is used only for rescans. When clicked, `AbortRescan` is called directly to cancel the rescan.

  Rescans triggered from the debug console will now be cancelable by clicking the cancel button.

  Rescans triggered by a command (e.g. `importmulti`) will now give an error indicating that the rescan was aborted by the user (either by the `abortrescan` command or by clicking cancel).

Tree-SHA512: 4bb14998766de686e2318fbc9805758eccf5dbe628a7257d072c9ae2fb4f61303a0876f49988d6e5eddb261969b8a307c81c0c2df0a42ae909a43d738af3dc1b
2018-04-13 20:51:59 +02:00
Andrew Chow 69b01e6f8b Add cancel button to rescan progress dialog
Adds a cancel button to the rescan progress dialog. When it is clicked,
AbortRescan is called to abort a rescan
2018-04-12 17:00:30 -04:00
Wladimir J. van der Laan f15b72f482
Merge #12650: gui: Fix issue: "default port not shown correctly in settings dialog"
40c5886 Fix illegal default `addProxy` and `addrSeparateProxyTor` settings. (251)

Pull request description:

  In f05d349 the value of the `addrProxy` and `addrSeparateProxyTor` settings is set to an illegal default value, because the value of `DEFAULT_GUI_PROXY_PORT ` is passed to the `fieldWidth` parameter of the `QString QString::arg(const QString &a, int fieldWidth = 0, QChar fillChar = QLatin1Char( ' ' )) const` method:

  29fad97c32/src/qt/optionsmodel.cpp (L129)

  29fad97c32/src/qt/optionsmodel.cpp (L139)

  This will create a default proxy setting that consists of 9053 characters and ends with the string `127.0.0.1:%2`.

  This PR attempts to resolve #12623 by setting the correct value for the `addrProxy` and `addrSeparateProxyTor` settings (i) if the proxy setting does not exist; or (ii) if the proxy setting has an illegal value caused by to the aforementioned bug.

  The second condition is *only* relevant if we don't want Bitcoin Core 0.16.0 users to explicitly reset their settings to see the correct default proxy port value.

Tree-SHA512: 3dc3de2eb7da831f6e318797df67341ced2076b48f9b561c73677bf6beb67b259d8e413095f290356fb92e32e4e8162d48accbc575c4e612060fd5d6dde7ac8d
2018-04-11 14:44:24 +02:00
practicalswift 1e7813e9bb Remove redundant initializations from the constructor 2018-04-11 11:56:44 +02:00
251 40c58866c7 Fix illegal default `addProxy` and `addrSeparateProxyTor` settings. 2018-04-10 22:22:55 +02:00
practicalswift f131872653 Initialize non-static class members where they are defined 2018-04-10 01:23:24 +02:00
practicalswift 73bc1b7cd2 Initialize editStatus and autoCompleter. Previously not initialized where defined or in constructor. 2018-04-10 01:17:20 +02:00
Darko Janković 7039319db5
Docs: fixed link, replaced QT with Qt 2018-04-09 22:55:36 +02:00
Wladimir J. van der Laan 0700b6f778
Merge #11851: scripted-diff: Rename wallet database classes
9b0f0c5 Add m_ prefix to WalletBatch::m_batch (Russell Yanofsky)
398c6f0 Update walletdb comment after renaming. (Russell Yanofsky)
ea23945 scripted-diff: Rename wallet database classes (Russell Yanofsky)

Pull request description:

  Scripted diff to rename some wallet classes. Motivated by discussion in https://github.com/bitcoin/bitcoin/pull/11687#discussion_r155354119

  | Current          | New                 |
  | ---------------- | ------------------- |
  | CDBEnv           | BerkeleyEnvironment |
  | CDB              | BerkeleyBatch       |
  | CWalletDBWrapper | WalletDatabase      |
  | CWalletDB        | WalletBatch         |

  Berkeley\* classes are intended to contain BDB specific code, while Wallet\* classes are intended to be more backend-agnostic.

  Also renamed associated variables:

  | Current             | New             |
  | ------------------- | --------------- |
  | dbw                 | database        |
  | pwalletdb           | batch           |
  | pwalletdbEncryption | encrypted_batch |

Tree-SHA512: 372f2e24b2deb59d4792b5ed578aaf0cce51b6db41c400bef5d0c2cd7833e62ae4d4afa0f6000268d52e15b20f737c5a55f1cecf7768556a782fd8cd6fe051d9
2018-04-09 19:29:54 +02:00