GUI: Sync RPC console wallet selector with main window selector#331
Open
kwsantiago wants to merge 1 commit into
Open
GUI: Sync RPC console wallet selector with main window selector#331kwsantiago wants to merge 1 commit into
kwsantiago wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switching wallets with the main window's toolbar selector does not update the RPC console's wallet selector. Commands typed into the console keep executing against the previously selected wallet, so a user who selects a wallet in the toolbar and then runs
sendtoaddressorgetbalancein the console silently operates on a different wallet than the one displayed.This is the exact failure mode 99c0eb9 ("Fix RPCConsole wallet selection") set out to prevent:
That commit connected the console to the open, restore and create wallet activities, but not to the toolbar selector, which is the most common way users switch wallets. The wallet migration path was never connected either.
Rather than adding a fourth per-callsite
connect(), this callsRPCConsole::setCurrentWallet()fromBitcoinGUI::setCurrentWallet(), alongside the existingwalletFrame->setCurrentWallet()call. Every path that changes the active wallet, including the toolbar selector and wallet migration, now keeps the console in sync.rpcConsoleis constructed in theBitcoinGUIconstructor, well before any wallet can be added, and the console's combo box has no signal connected back toBitcoinGUI, so there is no ordering hazard or signal loop.Testing
Built with the GUI and wallet enabled and exercised
bitcoin-qton regtest with two wallets loaded,""and"coin".Before, after selecting
coinin the toolbar:After:
The console's wallet selector also visibly follows the toolbar selection.
Additionally verified:
unloadwalletwhile the console pointed at that wallet: no crash, both selectors correctly hide with one wallet remaining, and the console falls back to the default wallet.BitcoinGUI::removeWallet()removes from the toolbar selector beforerpcConsole->removeWallet(), so the intermediatesetCurrentWallet()triggered bycurrentIndexChangedstill resolves a wallet the console knows about.test_bitcoin-qtpasses all suites.