mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
Merge bitcoin-core/gui#695: Fix misleading RPC console wallet message
576f7b8614
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:  In RPC calls, if no wallet is explicitly selected and there is exactly one wallet loaded, the [default](39363a4b94/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:39363a4b94/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: ACK576f7b8614
, tested on Ubuntu 22.04 (Qt 5.15.3). Tree-SHA512: 627da186025ba4f4e8df7fdd1b10363f923c4ecc50f023bbf2aece6e2593da65c45147c933effaca9040f813a6e46f034fc2d1ee2fb0f401000a3a6221a0e36e
This commit is contained in:
commit
ea41abade4
1 changed files with 2 additions and 2 deletions
|
@ -780,8 +780,8 @@ void RPCConsole::addWallet(WalletModel * const walletModel)
|
|||
{
|
||||
// use name for text and wallet model for internal data object (to allow to move to a wallet id later)
|
||||
ui->WalletSelector->addItem(walletModel->getDisplayName(), QVariant::fromValue(walletModel));
|
||||
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)
|
||||
if (ui->WalletSelector->count() == 2) {
|
||||
// First wallet added, set to default to match wallet RPC behavior
|
||||
ui->WalletSelector->setCurrentIndex(1);
|
||||
}
|
||||
if (ui->WalletSelector->count() > 2) {
|
||||
|
|
Loading…
Add table
Reference in a new issue