Page MenuHomePhabricator

Merge #13273: Qt/Bugfix: fix handling default wallet with no name
ClosedPublic

Authored by nakihito on Oct 11 2019, 23:13.

Details

Summary

13c3a659c0089f5ec2efeb98480dcd5041ec1c16 Qt/Bugfix: fix handling default wallet with no name (João Barbosa)

Pull request description:

If one loads a wallet via RPC (`loadwallet w2`), then select w2, select back to the default wallet (which is an empty string), that default wallet cannot be access through the RPC console because the current code only points to the wallet endpoint if the wallet name is not empty.

This is a quick fix that reenables accessing the default wallet in case an additional wallet has been loaded.

Using "" for the default wallet may not be ideal in other cases and it may make more sense to change it at a deeper level (wallet.cpp). See discussion here which where the reasons for the current behaviour in master:
https://github.com/bitcoin/bitcoin/pull/11687#issuecomment-370862718

@jnewbery @promag @ryanofsky

Tree-SHA512: 74b935886b4e4a6033a2f5e1f44bb69a252e31f4021e19a2054445a8e3e4db1d8ee256290850a84d8569d2d0e21412fce0170e7f0e881259156057587181ee05

Backport of Core PR13273
https://github.com/bitcoin/bitcoin/pull/13273/

Test Plan

This patch is not fully testable without D4236, but it fixes a bug that is not usually visible without dynamically loadable wallets.

arc patch D4236
arc patch D4245 (this patch)
make check
./bitcoin-qt
Help -> Debug -> Console
loadwallet ""

Pre patch, this would crash the gui
Post patch, this should simply fail

createwallet test
Make sure the default wallet is selected
getwalletinfo

Pre patch this would fail with the following error:

Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).  (code -19)

Post patch, this will succeed.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR13273
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7751
Build 13541: Bitcoin ABC Buildbot (legacy)
Build 13540: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Oct 11 2019, 23:13
nakihito edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Oct 11 2019, 23:26