Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

This is an overhaul of #11383 (plus some additions).
It avoids unnecessary coupling of httpserver/jsonrpc and the wallet as well as it avoids pointer pure passing (and pointer deletion) of CWallet (plus other minor design changes).

Additionally it adds the wallet name to the sendconfirmation and request dialog (in case multiwallet is active)

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think it's better to use the menu rather than add a dropbox, but as long as it's easy to change later it doesn't matter. I left some comments to better separate UI from model to make such a change easier. That already improved in this PR compared to #11383.

Nit: "Loading wallet" should be "Loading wallets" if there's more than 1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first item in the menu is now created in the UI file, while new ones are created programatically. Can you make them all programmatically or maybe find a way to clone elements? Can be done in a future PR too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a method on WalletModel? Otherwise you could use m_wallet_models->count(). Maybe we need a WalletsModel class to hold on to a series of wallets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best place for wallets manager functions like this is currently the WalletModel, long term, we may want to have a WalletsManager (see #12587).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to need a line break above:
wallet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fixed right? At least there's \n in the Amount: above.

@luke-jr
Copy link
Member

luke-jr commented Mar 6, 2018

This is strictly an inferior design to #11383, which already has ACKs and is ready for merging as-is.

The minor other improvements can be done on top of that.

@Sjors
Copy link
Member

Sjors commented Mar 6, 2018

@luke-jr it's not strictly better; this PR has a cleaner separation of model and view. I can't speak to the other differences.

@laanwj
Copy link
Member

laanwj commented Mar 12, 2018

Let's stop arguing just for sake of arguing and help move this forward. If this is not the perfect design I'm sure it can be improved in a later PR. I'll test it later.

@luke-jr
Copy link
Member

luke-jr commented Mar 12, 2018

Why does stop arguing mean merging this PR? #11383 is already reviewed and ready to merge...

@promag
Copy link
Contributor

promag commented Mar 14, 2018

Should rebase to have external wallet support (#11687).

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK.

Receiving addresses and Sending addresses dialogs could have the wallet name in the dialog title.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the underline, it's already bold.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its okay since the used wallet is a pretty critical information. Overhauling the send-confirmation dialog is something that would be possible in the long run.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, remove extra space before {.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fixed right? At least there's \n in the Amount: above.

@promag
Copy link
Contributor

promag commented Mar 15, 2018

Maybe running with -disablewallet should not show the wallet selector? Currently looks like:
screen shot 2018-03-15 at 00 56 32

@jonasschnelli
Copy link
Contributor Author

Added a commit that fixes the -disablewallet case (also won't show the RPCConsole wallet selector if only one wallet is present).

@fanquake
Copy link
Member

Testing 3b156cf on top of master (4ad3b3c). macOS 10.13.3, Qt 5.10.1
Wallet Selector:
selector

In the debug console if I try and use the help command with either wallet selected I get an error. Selecting (none) and using help works fine:
console

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK 3b156cf01fda530cca127079d630c295d839efc1, although I'm not very familiar with the qt code.

To aid review, the commits could be tidied up a little (some code is added and removed in a later commit) and squashed a bit.

A couple of comments inline.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that we should strip .dat from the wallet name now that #11687 is merged. Perhaps @ryanofsky has an opinion on this?

Also note that new default wallets will have the name "" (the empty string). Perhaps QT should display something different in this case?

EDIT: for now, I think the only way we can have the default wallet with its name set to "" is if we start bitcoin with no wallet arguments, in which case multiwallet isn't active and the dropdown won't appear. However, in future we'll have dynamic wallet loading/unloading, in which case we could have the default "" wallet plus named wallets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. For sure something to deal with later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is outdated and can be removed

@promag
Copy link
Contributor

promag commented Mar 26, 2018

Tested ACK 3b156cf.

Running with -disablewallet works as expected and @fanquake point is fixed. Agree with @jnewbery that commits could be tidied up a little, but I don't think that it should block this anymore.

@jonasschnelli
Copy link
Contributor Author

Force push fixed the outdated commit.
Can be verified by comparing 3b156cf01fda530cca127079d630c295d839efc1 against 779c5f9.

@jonasschnelli jonasschnelli merged commit 779c5f9 into bitcoin:master Mar 26, 2018
jonasschnelli added a commit that referenced this pull request Mar 26, 2018
779c5f9 Qt: hide RPCConsole wallet selector when no wallets are present (Jonas Schnelli)
dc6f150 Qt: show wallet name in request dlg in case of multiwallet (Jonas Schnelli)
4826ca4 Qt: show wallet name in send confirmation dlg in case of multiwallet (Jonas Schnelli)
cfa4133 GUI: RPCConsole: Log wallet changes (Luke Dashjr)
b6d04fc Qt: Get wallet name from WalletModel rather than passing it around (Luke Dashjr)
12d8d26 Qt: When multiple wallets are used, include in notifications the name (Jonas Schnelli)
d1ec34a Qt: QComboBox::setVisible doesn't work in toolbars, so defer adding it at all until needed (Luke Dashjr)
d49cc70 Qt: Add wallet selector to debug console (Jonas Schnelli)
d558f44 Bugfix: RPC: Add missing UnregisterHTTPHandler for /wallet/ (Luke Dashjr)
85d5319 Qt: Ensure UI updates only come from the currently selected walletView (Luke Dashjr)
e449f9a Qt: Add a combobox to toolbar to select from multiple wallets (Luke Dashjr)
3dba3c3 Qt: Load all wallets into WalletModels (Luke Dashjr)

Pull request description:

  This is an overhaul of #11383 (plus some additions).
  It avoids unnecessary coupling of httpserver/jsonrpc and the wallet as well as it avoids pointer pure passing (and pointer deletion) of `CWallet` (plus other minor design changes).

  Additionally it adds the wallet name to the sendconfirmation and request dialog (in case multiwallet is active)

Tree-SHA512: 3d06e18badbc5d1821e488bf1dae463bb0be544cf11b2b618e025812bfdd13c5f39604bb93b4c705313930e7dc4e66f4848b9469ba14871bade58e7a027246a1
@instagibbs
Copy link
Member

instagibbs commented Mar 26, 2018

argh, sorry for the late review

this logic here means that anytime we do a wallet match on rpc debug console, it will not find the wallet unless it has no .dat extension: 3dba3c3#diff-8c9d79ba40bf702f01685008550ac100R491

This also means you can load two wallets(eg wallet.dat and wallet), and they will look the same in the drop down selector.

imo if we're supporting arbitrary filename extensions we should just display the entire name

@ryanofsky
Copy link
Contributor

imo if we're supporting arbitrary filename extensions we should just display the entire name

Agree, it would be good to drop the special .dat extension handling (which is now in WalletModel::getWalletName().

@jnewbery
Copy link
Contributor

I also agree that we should remove the special .dat extension handling

@luke-jr
Copy link
Member

luke-jr commented Mar 26, 2018

Totally un-user-friendly. If we merged #11383 without the ugly regressions herein, it wouldn't have been a problem...

deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 10, 2019
Summary:
Completes T440

Original commit messages below:
-------------------------------
PR12610:

Merge #12610: Multiwallet for the GUI

779c5f9 Qt: hide RPCConsole wallet selector when no wallets are present (Jonas Schnelli)
dc6f150 Qt: show wallet name in request dlg in case of multiwallet (Jonas Schnelli)
4826ca4 Qt: show wallet name in send confirmation dlg in case of multiwallet (Jonas Schnelli)
cfa4133 GUI: RPCConsole: Log wallet changes (Luke Dashjr)
b6d04fc Qt: Get wallet name from WalletModel rather than passing it around (Luke Dashjr)
12d8d26 Qt: When multiple wallets are used, include in notifications the name (Jonas Schnelli)
d1ec34a Qt: QComboBox::setVisible doesn't work in toolbars, so defer adding it at all until needed (Luke Dashjr)
d49cc70 Qt: Add wallet selector to debug console (Jonas Schnelli)
d558f44 Bugfix: RPC: Add missing UnregisterHTTPHandler for /wallet/ (Luke Dashjr)
85d5319 Qt: Ensure UI updates only come from the currently selected walletView (Luke Dashjr)
e449f9a Qt: Add a combobox to toolbar to select from multiple wallets (Luke Dashjr)
3dba3c3 Qt: Load all wallets into WalletModels (Luke Dashjr)

Pull request description:

  This is an overhaul of #11383 (plus some additions).
  It avoids unnecessary coupling of httpserver/jsonrpc and the wallet as well as it avoids pointer pure passing (and pointer deletion) of `CWallet` (plus other minor design changes).

  Additionally it adds the wallet name to the sendconfirmation and request dialog (in case multiwallet is active)

Tree-SHA512: 3d06e18badbc5d1821e488bf1dae463bb0be544cf11b2b618e025812bfdd13c5f39604bb93b4c705313930e7dc4e66f4848b9469ba14871bade58e7a027246a1

Includes PR12795, since PR12610 introduced a bug:

Do not truncate .dat extension for wallets in gui

See bitcoin/bitcoin#12610 (comment) for details

Co-authored-by: Jason B. Cox <contact@jasonbcox.com>

Test Plan:
`ninja check && ninja check-functional`
`./src/qt/bitcoin-qt -testnet -wallet=wallet1 -wallet=wallet2`
Verify the following:
1. Visually verify that the wallet dropdown exists in the upper right-hand corner.
2. Selecting a wallet from the dropdown displays the transactions only associated with that wallet.
3. Requesting payment on a specified wallet generates an address for that wallet.
4. Visually verify that Debug window now has a dropdown containing both wallet options.
5. Selecting a particular wallet from the Debug dropdown and trying RPC commands only provides output relevant to the selected wallet (I used transaction IDs only known to one of the wallets to verify).

Reviewers: deadalnix, schancel, #bitcoin_abc, Fabien

Reviewed By: deadalnix, #bitcoin_abc, Fabien

Subscribers: Fabien, teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1979
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 12, 2020
779c5f9 Qt: hide RPCConsole wallet selector when no wallets are present (Jonas Schnelli)
dc6f150 Qt: show wallet name in request dlg in case of multiwallet (Jonas Schnelli)
4826ca4 Qt: show wallet name in send confirmation dlg in case of multiwallet (Jonas Schnelli)
cfa4133 GUI: RPCConsole: Log wallet changes (Luke Dashjr)
b6d04fc Qt: Get wallet name from WalletModel rather than passing it around (Luke Dashjr)
12d8d26 Qt: When multiple wallets are used, include in notifications the name (Jonas Schnelli)
d1ec34a Qt: QComboBox::setVisible doesn't work in toolbars, so defer adding it at all until needed (Luke Dashjr)
d49cc70 Qt: Add wallet selector to debug console (Jonas Schnelli)
d558f44 Bugfix: RPC: Add missing UnregisterHTTPHandler for /wallet/ (Luke Dashjr)
85d5319 Qt: Ensure UI updates only come from the currently selected walletView (Luke Dashjr)
e449f9a Qt: Add a combobox to toolbar to select from multiple wallets (Luke Dashjr)
3dba3c3 Qt: Load all wallets into WalletModels (Luke Dashjr)

Pull request description:

  This is an overhaul of bitcoin#11383 (plus some additions).
  It avoids unnecessary coupling of httpserver/jsonrpc and the wallet as well as it avoids pointer pure passing (and pointer deletion) of `CWallet` (plus other minor design changes).

  Additionally it adds the wallet name to the sendconfirmation and request dialog (in case multiwallet is active)

Tree-SHA512: 3d06e18badbc5d1821e488bf1dae463bb0be544cf11b2b618e025812bfdd13c5f39604bb93b4c705313930e7dc4e66f4848b9469ba14871bade58e7a027246a1
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 20, 2020
779c5f9 Qt: hide RPCConsole wallet selector when no wallets are present (Jonas Schnelli)
dc6f150 Qt: show wallet name in request dlg in case of multiwallet (Jonas Schnelli)
4826ca4 Qt: show wallet name in send confirmation dlg in case of multiwallet (Jonas Schnelli)
cfa4133 GUI: RPCConsole: Log wallet changes (Luke Dashjr)
b6d04fc Qt: Get wallet name from WalletModel rather than passing it around (Luke Dashjr)
12d8d26 Qt: When multiple wallets are used, include in notifications the name (Jonas Schnelli)
d1ec34a Qt: QComboBox::setVisible doesn't work in toolbars, so defer adding it at all until needed (Luke Dashjr)
d49cc70 Qt: Add wallet selector to debug console (Jonas Schnelli)
d558f44 Bugfix: RPC: Add missing UnregisterHTTPHandler for /wallet/ (Luke Dashjr)
85d5319 Qt: Ensure UI updates only come from the currently selected walletView (Luke Dashjr)
e449f9a Qt: Add a combobox to toolbar to select from multiple wallets (Luke Dashjr)
3dba3c3 Qt: Load all wallets into WalletModels (Luke Dashjr)

Pull request description:

  This is an overhaul of bitcoin#11383 (plus some additions).
  It avoids unnecessary coupling of httpserver/jsonrpc and the wallet as well as it avoids pointer pure passing (and pointer deletion) of `CWallet` (plus other minor design changes).

  Additionally it adds the wallet name to the sendconfirmation and request dialog (in case multiwallet is active)

Tree-SHA512: 3d06e18badbc5d1821e488bf1dae463bb0be544cf11b2b618e025812bfdd13c5f39604bb93b4c705313930e7dc4e66f4848b9469ba14871bade58e7a027246a1
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants