Skip to content

Conversation

@john-moffett
Copy link
Contributor

Misleading message from RPCConsole window

In certain circumstances, the GUI console will display the message 'Executing command without any wallet' when it is, in fact, using the currently loaded wallet. For instance:

scr3

In RPC calls, if no wallet is explicitly selected and there is exactly one wallet loaded, the default is to act on that loaded wallet.

The GUI console acts that way in reality, but sometimes erroneously reports that it's not acting on any particular wallet. The root issue is due to the logic that prevents changing the selected wallet if the RPCConsole is visible:

gui/src/qt/rpcconsole.cpp

Lines 783 to 786 in 39363a4

if (ui->WalletSelector->count() == 2 && !isVisible()) {
// First wallet added, set to default so long as the window isn't presently visible (and potentially in use)
ui->WalletSelector->setCurrentIndex(1);
}

This PR removes that unnecessary logic. This does have some ramifications. Prior to this PR, if a user opened the console window without any wallets loaded, then opened two or more wallets, the RPC console would select "None" of the wallets and any wallet-specific RPCs would fail. However, the behavior was different if the user hadn't had the console window open. In that case, if they opened the RPC Console window after loading at least the first wallet, it would select the first-loaded wallet. This context-dependent behavior is (IMO) undesirable, and this PR changes it to be consistent.

In certain circumstances, the GUI console will display
the message 'Executing command without any wallet' when
it is, in fact, using the default wallet.

In RPC calls, if no wallet is explicitly selected and
there is exactly one wallet loaded, the default is to
act on that loaded wallet.

The GUI console acts that way in reality, but
erroneously reports that it's not acting on any
particular wallet.
@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 9, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK hebasto

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@jarolrod jarolrod added Bug Something isn't working UX All about "how to get things done" labels Jan 13, 2023
@hebasto
Copy link
Member

hebasto commented Jan 16, 2023

Confirming the bug on Ubuntu 22.04 (Qt 5.15.3).

Concept ACK.

@hebasto hebasto changed the title Fix: misleading RPC console wallet message Fix misleading RPC console wallet message Jan 16, 2023
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK 576f7b8, tested on Ubuntu 22.04 (Qt 5.15.3).

This patch also fixes another buggy behavior for me. Steps to reproduce it on the master branch:

  1. Run bitcoin-qt -nowallet.
  2. Open the "Console" tab of the "Node window".
  3. Open a wallet.
  4. Run getwalletinfo in the "Console" tab -- BUG: No "Executing command using..." message.
  5. Open another wallet.
  6. The wallet selector in the "Console" tab has the "none" value. Not a bug(?), but unexpected behavior (already mentioned in the PR description).

@hebasto hebasto merged commit ea41aba into bitcoin-core:master Feb 2, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 3, 2023
576f7b8 Fix misleading RPC console wallet message (John Moffett)

Pull request description:

  ## Misleading message from RPCConsole window ##

  In certain circumstances, the GUI console will display the message 'Executing command without any wallet' when it is, in fact, using the currently loaded wallet. For instance:

  ![scr3](https://user-images.githubusercontent.com/116917595/211404066-d49a6cbf-d3c3-4e89-8720-3583c6acf521.gif)

  In RPC calls, if no wallet is explicitly selected and there is exactly one wallet loaded, the [default](https://github.com/bitcoin-core/gui/blob/39363a4b945114f5e4718f75098f3036e8fe6a1d/src/wallet/rpc/util.cpp#L71-L93) is to act on that loaded wallet.

  The GUI console acts that way in reality, but sometimes erroneously reports that it's not acting on any particular wallet. The root issue is due to the logic that prevents changing the selected wallet if the RPCConsole is visible:

  https://github.com/bitcoin-core/gui/blob/39363a4b945114f5e4718f75098f3036e8fe6a1d/src/qt/rpcconsole.cpp#L783-L786

  This PR removes that unnecessary logic. This does have some ramifications. Prior to this PR, if a user opened the console window without any wallets loaded, then opened two or more wallets, the RPC console would select "None" of the wallets and any wallet-specific RPCs would fail. However, the behavior was different if the user hadn't had the console window open. In that case, if they opened the RPC Console window _after_ loading at least the first wallet, it would select the first-loaded wallet. This context-dependent behavior is (IMO) undesirable, and this PR changes it to be consistent.

ACKs for top commit:
  hebasto:
    ACK 576f7b8, tested on Ubuntu 22.04 (Qt 5.15.3).

Tree-SHA512: 627da186025ba4f4e8df7fdd1b10363f923c4ecc50f023bbf2aece6e2593da65c45147c933effaca9040f813a6e46f034fc2d1ee2fb0f401000a3a6221a0e36e
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Bug Something isn't working UX All about "how to get things done"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants