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

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2018/05/loadwallet_fix changing 1 files +3 −3
  1. jonasschnelli commented at 9:13 AM on May 18, 2018: contributor

    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

  2. jonasschnelli added the label GUI on May 18, 2018
  3. jonasschnelli force-pushed on May 18, 2018
  4. jonasschnelli force-pushed on May 18, 2018
  5. promag commented at 2:37 PM on May 18, 2018: member

    utACK 3033bf9, it is now possible to use the default wallet in the console.

    Please see fe9becaff as an alternative and smaller fix.

  6. in src/qt/rpcconsole.cpp:428 in 3033bf9c53 outdated
     424 | @@ -425,7 +425,7 @@ void RPCExecutor::request(const QString &command, const QString &walletID)
     425 |              return;
     426 |          }
     427 |          std::string wallet_id = walletID.toStdString();
     428 | -        if(!RPCConsole::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, &wallet_id))
     429 | +        if(!RPCConsole::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, (use_wallet) ? &wallet_id : nullptr))
    


    ryanofsky commented at 3:03 PM on May 18, 2018:

    parentheses around use_wallet seem odd

  7. ryanofsky commented at 3:11 PM on May 18, 2018: member

    utACK for both 3033bf9c5354f710d5f18fbcdb3a48ec16fe98ff and fe9becaff77353df14da721086b394f418ba5f03. Promag's fix in fe9becaff77353df14da721086b394f418ba5f03 seems simpler and more elegant though, so maybe it would be good to reset this PR to that change and merge it.

  8. Qt/Bugfix: fix handling default wallet with no name 13c3a659c0
  9. jonasschnelli force-pushed on May 18, 2018
  10. jonasschnelli commented at 6:09 PM on May 18, 2018: contributor

    Switch to https://github.com/bitcoin/bitcoin/commit/fe9becaff77353df14da721086b394f418ba5f03 which is the better approach... I have thought, similar to std::string, there is no concept of nullness for QStrings.

  11. jnewbery commented at 7:00 PM on May 18, 2018: member

    utACK 13c3a659c0089f5ec2efeb98480dcd5041ec1c16

  12. laanwj commented at 1:24 PM on May 29, 2018: member

    utACK 13c3a659c0089f5ec2efeb98480dcd5041ec1c16

  13. laanwj merged this on May 29, 2018
  14. laanwj closed this on May 29, 2018

  15. laanwj referenced this in commit 3fd0c2336a on May 29, 2018
  16. jasonbcox referenced this in commit ce33ec89a9 on Oct 25, 2019
  17. PastaPastaPasta referenced this in commit 160061dc59 on Dec 16, 2020
  18. PastaPastaPasta referenced this in commit faa6361c63 on Dec 18, 2020
  19. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me