Commit graph

97 commits

Author SHA1 Message Date
João Barbosa 57908a739c interfaces: Add Chain::requestMempoolTransactions 2019-03-31 11:37:28 +01:00
Russell Yanofsky d358466de1 Remove remaining wallet accesses to node globals 2019-03-06 16:47:57 -05:00
Russell Yanofsky b1b2b23892 Remove use of CCoinsViewMemPool::GetCoin in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
Russell Yanofsky 4e4d9e9f85 Remove use of CRPCTable::appendCommand in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
Russell Yanofsky 91868e6288 Remove use CValidationInterface in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
Russell Yanofsky 4d4e4c6448 Suggested interfaces::Chain cleanups from #15288
Mostly documentation improvements requested in the last review of #15288 before
it was merged
(https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-210241864)
2019-03-04 15:57:58 -05:00
Russell Yanofsky a1df1b48a8 Remove use of IsInitialBlockDownload in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 1106a6fde4 Remove use of uiInterface.LoadWallet in wallet code
This also changes the uiInterface.LoadWallet signal argument type from
shared_ptr<CWallet> to unique_ptr<interfaces::Wallet> because CWallet is an
internal wallet class that shouldn't be used in non-wallet code (and also can't
be passed across process boundaries).

This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky d02b34c8a8 Remove use of AcceptToMemoryPool in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky e2c8ba9f6e Remove uses of InitMessage/Warning/Error in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky c5e59a96a8 Remove uses of GetAdjustedTime in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 6d6bcc77c0 Remove use of g_connman / PushInventory in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 00dfb2a440 Remove uses of g_connman in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cc3836e8f9 Remove uses of fPruneMode in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cc02c796d3 Remove uses of fee globals in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 1fb0a4a04e Remove use of CalculateMemPoolAncestors in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cd32160af0 Remove use of GetTransactionAncestry in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 291276f7f4 Remove use of GetCountWithDescendants in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky bdc6628683 Remove use of IsRBFOptIn in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 80f52a2267 Remove uses of CheckFinalTx in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
João Barbosa 53b310390c refactor: Drop redundant wallet reference 2019-02-21 16:19:29 +00:00
João Barbosa f6122abe03 interfaces: Add remove to Wallet 2019-02-12 22:07:45 +00:00
Jonas Schnelli 7d3f255316
Merge #15153: gui: Add Open Wallet menu
1951ea434 gui: Show indeterminate progress dialog while opening walllet (João Barbosa)
8847cdaaa gui: Add OpenWalletActivity (João Barbosa)
4c8982a88 interfaces: Avoid interface instance if wallet is null (João Barbosa)
be82dea23 gui: Add thread to run background activity in WalletController (João Barbosa)
6c49a55b4 gui: Add Open Wallet menu (João Barbosa)
32a8c6abf gui: Add openWallet and getWalletsAvailableToOpen to WalletController (João Barbosa)
ab288b4e5 interfaces: Add loadWallet to Node (João Barbosa)
17abc0fd5 wallet: Factor out LoadWallet (João Barbosa)

Pull request description:

  The *Open Wallet* menu has all the available wallets currently not loaded. The list of the available wallets comes from `listWalletDir`.

  In the future the menu can be replaced by a custom dialog.

  <img width="674" alt="screenshot 2019-01-12 at 12 17 02" src="https://user-images.githubusercontent.com/3534524/51073166-ac041480-1664-11e9-8302-be81702bc146.png">

Tree-SHA512: ebfd75eee0c8264863748899843afab67dadb7dff21313c11e3cb5b6108d954978dd1f1ae786bc07580c5a771ea4ab38d18c1643c9b9b3683ed53f0f6c582e38
2019-02-12 08:20:50 -10:00
MeshCollider 6f4e0d1542
Merge #15226: Allow creating blank (empty) wallets (alternative)
7687f7873 [wallet] Support creating a blank wallet (Andrew Chow)

Pull request description:

  Alternative (kind of) to #14938

  This PR adds a `blank` parameter to the `createwallet` RPC to create a wallet that has no private keys initially. `sethdseed` can then be used to make a clean wallet with a custom seed. `encryptwallet` can also be used to make a wallet that is born encrypted.

  Instead of changing the version number as done in #14938, a wallet flag is used to indicate that the wallet should be blank. This flag is set at creation, and then unset when the wallet is no longer blank. A wallet becomes non-blank when a HD seed is set or anything is imported. The main change to create a blank wallet is primarily taken from #14938.

  Also with this, the term "blank wallet" is used instead of "empty wallet" to avoid confusion with wallets that have balance which would also be referred to as "empty".

  This is built on top of #15225 in order to fix GUI issues.

Tree-SHA512: 824d685e11ac2259a26b5ece99c67a7bda94a570cd921472c464243ee356b7734595ad35cc439b34357135df041ed9cba951e6edac194935c3a55a1dc4fcbdea
2019-02-11 08:08:33 +13:00
Andrew Chow 7687f7873b [wallet] Support creating a blank wallet
A blank wallet is a wallet that has no keys, script or watch only things.
A new wallet flag indicating that it is blank will be set when the wallet
is blank. Once it is no longer blank (a seed has been generated, keys or
scripts imported, etc), the flag will be unset.
2019-02-10 12:24:53 -05:00
MarcoFalke faa46475d7
wallet: Add lock annotation for mapAddressBook 2019-02-07 15:22:14 -05:00
MarcoFalke bbdcc0b0ff
Merge #15342: Suggested wallet code cleanups from #14711
aebafd0edf Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa771 Drop redundant get_value_or (Russell Yanofsky)
84adb206fc Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b464 Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093233 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c934 Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b599 Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from #14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8
2019-02-05 10:38:13 -05: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
João Barbosa 4c8982a88e interfaces: Avoid interface instance if wallet is null 2019-02-04 12:20:42 +00:00
João Barbosa ab288b4e59 interfaces: Add loadWallet to Node 2019-02-04 12:20:42 +00:00
Russell Yanofsky aebafd0edf Rename Chain getLocator -> getTipLocator
Suggested https://github.com/bitcoin/bitcoin/pull/14711#discussion_r252044389
2019-02-01 16:17:43 -05: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
Wladimir J. van der Laan 7c09e209ef
Merge #15225: GUI: Change the receive button to respond to keypool state changing
2bc4c3eaf9 Notify the GUI that the keypool has changed to set the receive button (Andrew Chow)
14bcdbe09c Check for more than private keys disabled to show receive button (Andrew Chow)

Pull request description:

  Currently the Receive button in the GUI is displayed enabled or disabled by the initial state of the wallet when the wallet is first loaded. The button is only enabled or disabled depending on whether the disable private keys flag is set when the wallet is loaded. However, future changes to the wallet means that this initial state and check may no longer be accurate. #14938 introduces empty wallets which do not have private keys. An empty wallet that is loaded should have the Receive button disabled, and then it should become enabled once `sethdseed` is used so that a keypool can be generated and new keys generated. Likewise, with #14075, a wallet can be loaded with no keypool initially, so the button should be disabled. Later, public keys can be imported into the keypool, at which time the button should become enabled. When the keypool runs out again (no new keys are generated as the keypool only consists of imports), the button should become disabled.

  This PR makes it so that the button becomes enabled and disabled as the keypool state changes. The check for whether to enable or disable the receive button has changed to checking whether it is possible to get new keys. It now checks for whether the wallet has an HD seed and, if not, whether the private keys are disabled. When an action happens which would make it possible for a new address to be retrieved or make it possible for a no more addresses to be retrieved, a signal is emitted which has the GUI recheck the conditions for the Receive button. These actions are setting a new HD seed, topping up the keypool, retrieving a key from the keypool, and returning a key to the keypool.

Tree-SHA512: eff15a5337f4c64ecd7169414fb47053c04f6a0f0130341b6dd9799ac4d79f451e25284701c668971fca33f0909d5352a474a2c12349375bedfdb59b63077d50
2019-01-31 15:11:32 +01:00
MeshCollider 72ca72e637
Merge #14711: Remove uses of chainActive and mapBlockIndex in wallet code
44de1561a Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f0264 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb07929 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1d6 Add time methods to the Chain interface (Russell Yanofsky)
700c42b85 Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger #10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in #10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8
2019-01-30 13:03:32 +13:00
MarcoFalke 77777c5624
log: Construct global logger on first use 2019-01-29 15:30:24 -05:00
Andrew Chow 2bc4c3eaf9 Notify the GUI that the keypool has changed to set the receive button
Whenever the keypool changes (new keys generated, new seed set,
keypool runs out, etc.), notify the GUI that the keypool has changed. The
receive button can then be enabled and disabled as necessary.
2019-01-23 15:18:03 -05:00
Cory Fields af3503d903 net: move BanMan to its own files 2019-01-16 13:54:18 -05:00
Cory Fields 4c0d961eb0 banman: create and split out banman
Some say he has always been.
2019-01-16 13:54:18 -05:00
Cory Fields 7cc2b9f678 net: Break disconnecting out of Ban()
These are separate events which need to be carried out by separate subsystems.

This also cleans up some whitespace and tabs in qt to avoid getting flagged by
the linter.

Current behavior is preserved.
2019-01-16 11:04:05 -05:00
Russell Yanofsky 44de1561aa Remove remaining chainActive references from CWallet
This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky db21f02648 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis
Only change in behavior is "Rescan started from block <height>" message
replaced by "Rescan started from block <hash>" message in
ScanForWalletTransactions.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky 2ffb07929e Add findFork and findBlock to the Chain interface
And use them to remove uses of chainActive and mapBlockIndex in wallet code

This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky d93c4c1d6e Add time methods to the Chain interface
And use them to remove uses of chainActive and mapBlockIndex in wallet code

This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky 700c42b85d Add height, depth, and hash methods to the Chain interface
And use them to remove uses of chainActive and mapBlockIndex in wallet code

This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 12:42:00 -04:00
Wladimir J. van der Laan e8ad580f51
Merge #14556: qt: fix confirmed transaction labeled "open" (#13299)
fb3ce75807 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  Fix #13299.

  Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed (ref: #1026).

  This PR makes the wallet mark a transaction "Unconfirmed" instead of misleading "Open for NNN more blocks" when syncing after a period of being offline.

  Before this PR (with the issue):
  ![screenshot from 2018-12-12 15-56-23](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
2019-01-15 17:39:19 +01:00
Jonas Schnelli 84d0fdce11
Merge #13216: [Qt] implements concept for different disk sizes on intro
9d0e52834 implements different disk sizes for different networks on intro (marcoagner)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/13213.
  Mostly, I layed out the concept to open the PR for refinement and getting feedback if the approach is okay. Changes are expected.

  Two points:
  - The values for both new consts `TESTNET_BLOCK_CHAIN_SIZE` and `TESTNET_CHAIN_STATE_SIZE` is certainly not optimal; I just checked the size of my testnet3 related dirs and set them to little bit higher values. Which values should be used?
  - Should we do something like this to regtest? Or these "niceties" do not matter when on regtest?

  Thanks!

Tree-SHA512: 8ae87a29fa8356b899e7a823c76cde793d9126b4ee59554d7a2a8edb088fe42a19976b34c06c2fd4a98a727e1e4971dd983f42b6093ea6caa255b45004e22bb4
2019-01-11 14:33:24 -10:00
Hennadii Stepanov fb3ce75807
Don't label transactions "Open" while catching up
Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled,
the checking `wtx.is_final` is meaningless until the syncing has
completed.
2019-01-03 00:10:24 +02:00
Murray Nesbitt c54e5a41c4 Remove unreferenced boost headers 2018-11-16 03:20:44 +00: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