rpc: Add specific error code for "wallet already loaded" #20964

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2021-01-wallet-already-loaded-rpc changing 3 files +15 −3
  1. laanwj commented at 2:18 PM on January 19, 2021: member

    Add a separate RPC error code for "wallet already loaded" to avoid having to match on message to detect this. Requested by shesek for rust-bitcoinrpc.

    If concept ACKed needs:

    • Release note
    • A functional test (updated the existing test to make it pass, I think this is enough)
  2. laanwj added the label Wallet on Jan 19, 2021
  3. laanwj added the label RPC/REST/ZMQ on Jan 19, 2021
  4. laanwj marked this as a draft on Jan 19, 2021
  5. laanwj force-pushed on Jan 19, 2021
  6. jonatack commented at 3:08 PM on January 19, 2021: member

    Concept ACK per IRC discussion starting from http://www.erisian.com.au/bitcoin-core-dev/log-2021-01-19.html#l-173

  7. laanwj force-pushed on Jan 19, 2021
  8. laanwj marked this as ready for review on Jan 20, 2021
  9. meshcollider commented at 9:46 AM on January 21, 2021: contributor

    Concept ACK

  10. in src/wallet/rpcwallet.cpp:2627 in 053741b6c3 outdated
    2623 | +                code = RPC_WALLET_NOT_FOUND;
    2624 | +                break;
    2625 | +            case DatabaseStatus::FAILED_ALREADY_LOADED:
    2626 | +                code = RPC_WALLET_ALREADY_LOADED;
    2627 | +                break;
    2628 | +            default:
    


    eilx2 commented at 2:04 AM on January 24, 2021:

    Maybe set code to RPC_WALLET_ERROR in default instead of initiliasing it?

                default:
                    code = RPC_WALLET_ERROR;
    

    laanwj commented at 10:44 PM on January 24, 2021:

    What would be the difference? I personally prefer variables to be initialized where they are defined, so that if code later change the risk of introducing undefined behavior is smaller.


    eilx2 commented at 11:32 PM on January 24, 2021:

    No difference, just makes it more clear that by default the error code is RPC_WALLET_ERROR.


    laanwj commented at 6:54 AM on January 25, 2021:

    Sure. I'll add a comment.

  11. eilx2 approved
  12. eilx2 commented at 2:05 AM on January 24, 2021: none

    Looks good to me.

  13. rpc: Add specific error code for "wallet already loaded" a6739cc868
  14. laanwj force-pushed on Jan 25, 2021
  15. jonasschnelli approved
  16. jonasschnelli commented at 7:55 AM on January 25, 2021: contributor

    Code Review ACK a6739cc86827759c543bf81f5532ec46e40549c3

  17. promag commented at 11:52 AM on January 27, 2021: member

    Code review ACK a6739cc86827759c543bf81f5532ec46e40549c3.

  18. laanwj merged this on Jan 27, 2021
  19. laanwj closed this on Jan 27, 2021

  20. sidhujag referenced this in commit 6ff2dd4433 on Jan 27, 2021
  21. meshcollider added the label Needs release note on Jan 27, 2021
  22. DrahtBot locked this on Aug 18, 2022
  23. fanquake removed the label Needs release note on Sep 15, 2022
  24. fanquake commented at 3:14 PM on September 15, 2022: member

    This change was part of 22.0, removing "Needs release note".


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-13 15:14 UTC

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