Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Support wallets loaded dynamically #13097

Merged
merged 3 commits into from May 18, 2018

Conversation

promag
Copy link
Member

@promag promag commented Apr 26, 2018

Add support in the UI for wallets loaded dynamically.

@promag
Copy link
Member Author

promag commented Apr 26, 2018

@ryanofsky had to convert interfaces::Wallet to shared pointer because of QueuedConnection. Do you have an alternative? Like instancing WalletModel on RPC thread and then make that the slot argument?

@promag
Copy link
Member Author

promag commented Apr 26, 2018

Previous version in promag/2018-04-ui-wallet-loaded.1, now WalletModel* is the argument in the queued connection.

@promag
Copy link
Member Author

promag commented Apr 26, 2018

@jnewbery mind testing this?

@promag promag force-pushed the 2018-04-ui-wallet-loaded branch 2 times, most recently from eb495bb to e15724a Compare April 26, 2018 20:53
@jnewbery
Copy link
Contributor

@jnewbery mind testing this?

Will do! (next week)

@promag
Copy link
Member Author

promag commented Apr 26, 2018

In order to test, suppose there are wallets w1 and w2:

  • launch bitcoin-qt -regtest -nowallet
  • open console and run loadwallet w1 (should show wallet)
  • run loadwallet w2 (should show multi-wallet selector)

@@ -250,7 +251,8 @@ public Q_SLOTS:
QTimer *pollShutdownTimer;
#ifdef ENABLE_WALLET
PaymentServer* paymentServer;
std::vector<WalletModel*> m_wallet_models;
std::list<WalletModel*> m_wallet_models;
Copy link
Member Author

Choose a reason for hiding this comment

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

Revert to vector.

window->setCurrentWallet(walletModel->getWalletName());
}

connect(walletModel, SIGNAL(coinsSent(WalletModel*,SendCoinsRecipient,QByteArray)),
Copy link
Member Author

Choose a reason for hiding this comment

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

Improve format.

@jnewbery
Copy link
Contributor

Please update title to indicate that this PR is for GUI support for wallets loaded at runtime.

Please rebase on #10740 (which I just rebased on master) to pick up the wallet: Make vpwallets usage thread safe commit

@promag promag changed the title Support wallets loaded dynamically ui: Support wallets loaded dynamically Apr 30, 2018
@promag
Copy link
Member Author

promag commented Apr 30, 2018

@jnewbery done.

@jnewbery
Copy link
Contributor

Tested ACK c9048b9213f7e9dc9b8da9b06c2caccd27f8c3cc

@jnewbery
Copy link
Contributor

This (and #13100) need to update doc/release-notes-pr10740.md to state that dynamic wallet loading is supported in the GUI.

@promag promag force-pushed the 2018-04-ui-wallet-loaded branch from c9048b9 to 92f27ed Compare May 1, 2018 21:12
@promag
Copy link
Member Author

promag commented May 1, 2018

@jnewbery done (here).

@meshcollider
Copy link
Contributor

Concept ACK

@laanwj laanwj added this to Blockers in High-priority for review May 3, 2018
@jnewbery jnewbery added this to In progress in Multiwallet support May 3, 2018
@jnewbery
Copy link
Contributor

jnewbery commented May 4, 2018

@promag - this requires a rebase for one of my commits. I've rebased #10740. I suggest you reset to that branch and then cherrypick your commits.

@promag promag force-pushed the 2018-04-ui-wallet-loaded branch from 92f27ed to ab8b66c Compare May 4, 2018 21:58
@promag
Copy link
Member Author

promag commented May 4, 2018

@jnewbery rebased.

@jonasschnelli
Copy link
Contributor

utACK 0e674ba though I would prefer if the glitches would be fixed before merge

@jnewbery
Copy link
Contributor

the initial "default" wallet did had no name in the dropdown.

Yes - this is a result of #11687 (comment) , and is also visible in the listwallets and getwalletinfo RPC calls.

This PR does introduce that behaviour, but does make it more visible when loading a second wallet.

@promag
Copy link
Member Author

promag commented May 17, 2018

@jonasschnelli launching with bitcoin-qt -regtest -wallet -wallet=w1 also adds an empty item to the checkbox.

@promag
Copy link
Member Author

promag commented May 17, 2018

@jonasschnelli care to test again? Will squash after that.

@jonasschnelli
Copy link
Contributor

Tested ACK 2e75134

@jonasschnelli jonasschnelli merged commit 2e75134 into bitcoin:master May 18, 2018
jonasschnelli added a commit that referenced this pull request May 18, 2018
2e75134 fixup! ui: Support wallets loaded dynamically (João Barbosa)
0e674ba ui: Support wallets loaded dynamically (João Barbosa)
1c8fe0b ui: Remove unnecessary variable fFirstWallet (João Barbosa)

Pull request description:

  Add support in the UI for wallets loaded dynamically.

Tree-SHA512: 4016d61580b31e28c49861b1cb0e77fac5417f9676a6ce6156be28cb6059fdf3d3dd4d57dbbc22a574ad428c2a4a3702aedca596a84e644ce148e1084feb29c9
@laanwj laanwj removed this from Blockers in High-priority for review May 18, 2018
@promag promag deleted the 2018-04-ui-wallet-loaded branch May 20, 2018 17:29
@fanquake fanquake moved this from In progress to Done in Multiwallet support Jun 1, 2018
@ken2812221
Copy link
Contributor

default
default

If wallet failed to load because of pruned mode, the dropdown menu shows the wallet.

maflcko pushed a commit that referenced this pull request Jun 20, 2018
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in #13063 (80b4910) where #13097 made possible to get "hit" by that bug. Reported by @ken2812221 (#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 25, 2019
Summary:
2e75134 fixup! ui: Support wallets loaded dynamically (João Barbosa)
0e674ba ui: Support wallets loaded dynamically (João Barbosa)
1c8fe0b ui: Remove unnecessary variable fFirstWallet (João Barbosa)

Pull request description:

  Add support in the UI for wallets loaded dynamically.

Tree-SHA512: 4016d61580b31e28c49861b1cb0e77fac5417f9676a6ce6156be28cb6059fdf3d3dd4d57dbbc22a574ad428c2a4a3702aedca596a84e644ce148e1084feb29c9

Backport of Core PR13097
bitcoin/bitcoin#13097

Depends on D4245
This dependency is a bug fix.

Test Plan:
  make check
Create a new wallet first
  ./bitcoind
  ./bitcoin-cli createwallet "testwallet"
  ./bitcoin-cli -rpcwallet="testwallet" getwalletinfo
  kill bitcoind
The `getwalletinfo` rpc should output something like this:
  {
    "walletname": "testwallet",
    "walletversion": 200300,
    "balance": 0.00000000,
    "unconfirmed_balance": 0.00000000,
    "immature_balance": 0.00000000,
    "txcount": 0,
    "keypoololdest": 1570729970,
    "keypoolsize": 1000,
    "keypoolsize_hd_internal": 1000,
    "paytxfee": 0.00000000,
    "hdmasterkeyid": "e0c38684642d0301c5db7f5e2a43ea3a84764fec"
  }

Open bitcoin-qt and then load the new wallet
  ./bitcoin-qt
  Help -> Debug -> Console
  loadwallet "testwallet"
In the upper left corner under the menu bar, use the drop-down menu labeled `wallets` to select `testwallet`.
In the console input:
  getwalletinfo
This should output the same as above

Close the console window.
In the upper right corner of the main menu, use the drop-down menu labeled `wallets` to select `testwallet`.
The window should now display the information for `testwallet`.

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien, jasonbcox

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4236
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 25, 2019
Summary:
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in #13063 (80b4910) where #13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin/bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f

Backport of Core PR13506
bitcoin/bitcoin#13506

Depends on D4236

Test Plan:
  make check
  bitcoin-qt --regtest --nowallet -usehd=0
  Help -> Debug -> Console
  loadwallet wallet.dat
Before this patch, the gui would throw an error window, but the wallet would still be selectable from the multiwallet drop down menu and the wallet information would still be displayed on the main window.
After this patch, the gui should throw an error window and there should still be no wallet loaded and/or displayed in the main window.
In both cases, the console will output `Wallet loading failed. (error code -4).`

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D4238
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 16, 2020
2e75134 fixup! ui: Support wallets loaded dynamically (João Barbosa)
0e674ba ui: Support wallets loaded dynamically (João Barbosa)
1c8fe0b ui: Remove unnecessary variable fFirstWallet (João Barbosa)

Pull request description:

  Add support in the UI for wallets loaded dynamically.

Tree-SHA512: 4016d61580b31e28c49861b1cb0e77fac5417f9676a6ce6156be28cb6059fdf3d3dd4d57dbbc22a574ad428c2a4a3702aedca596a84e644ce148e1084feb29c9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 16, 2020
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 18, 2020
2e75134 fixup! ui: Support wallets loaded dynamically (João Barbosa)
0e674ba ui: Support wallets loaded dynamically (João Barbosa)
1c8fe0b ui: Remove unnecessary variable fFirstWallet (João Barbosa)

Pull request description:

  Add support in the UI for wallets loaded dynamically.

Tree-SHA512: 4016d61580b31e28c49861b1cb0e77fac5417f9676a6ce6156be28cb6059fdf3d3dd4d57dbbc22a574ad428c2a4a3702aedca596a84e644ce148e1084feb29c9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 18, 2020
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
xdustinface pushed a commit to xdustinface/dash that referenced this pull request Apr 4, 2021
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
xdustinface pushed a commit to xdustinface/dash that referenced this pull request Apr 4, 2021
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
xdustinface pushed a commit to xdustinface/dash that referenced this pull request Apr 4, 2021
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
xdustinface pushed a commit to xdustinface/dash that referenced this pull request Apr 4, 2021
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
xdustinface pushed a commit to xdustinface/dash that referenced this pull request Apr 5, 2021
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
xdustinface pushed a commit to xdustinface/dash that referenced this pull request Apr 13, 2021
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
@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.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants