-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Qt/Bugfix: fix handling default wallet with no name #13273
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
Conversation
3ac1fb2
to
3033bf9
Compare
utACK 3033bf9, it is now possible to use the default wallet in the console. Please see fe9beca as an alternative and smaller fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/qt/rpcconsole.cpp
Outdated
@@ -425,7 +425,7 @@ void RPCExecutor::request(const QString &command, const QString &walletID) | |||
return; | |||
} | |||
std::string wallet_id = walletID.toStdString(); | |||
if(!RPCConsole::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, &wallet_id)) | |||
if(!RPCConsole::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, (use_wallet) ? &wallet_id : nullptr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parentheses around use_wallet seem odd
3033bf9
to
13c3a65
Compare
Switch to fe9beca which is the better approach... I have thought, similar to std::string, there is no concept of |
utACK 13c3a65 |
1 similar comment
utACK 13c3a65 |
13c3a65 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: #11687 (comment) @jnewbery @promag @ryanofsky Tree-SHA512: 74b935886b4e4a6033a2f5e1f44bb69a252e31f4021e19a2054445a8e3e4db1d8ee256290850a84d8569d2d0e21412fce0170e7f0e881259156057587181ee05
Summary: 13c3a65 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: bitcoin/bitcoin#11687 (comment) @jnewbery @promag @ryanofsky Tree-SHA512: 74b935886b4e4a6033a2f5e1f44bb69a252e31f4021e19a2054445a8e3e4db1d8ee256290850a84d8569d2d0e21412fce0170e7f0e881259156057587181ee05 Backport of Core PR13273 bitcoin/bitcoin#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. Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D4245
13c3a65 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: bitcoin#11687 (comment) @jnewbery @promag @ryanofsky Tree-SHA512: 74b935886b4e4a6033a2f5e1f44bb69a252e31f4021e19a2054445a8e3e4db1d8ee256290850a84d8569d2d0e21412fce0170e7f0e881259156057587181ee05
13c3a65 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: bitcoin#11687 (comment) @jnewbery @promag @ryanofsky Tree-SHA512: 74b935886b4e4a6033a2f5e1f44bb69a252e31f4021e19a2054445a8e3e4db1d8ee256290850a84d8569d2d0e21412fce0170e7f0e881259156057587181ee05
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:
#11687 (comment)
@jnewbery @promag @ryanofsky