wallet: return error from bitcoin-wallet create #36341

pull kriss39 wants to merge 1 commits into bitcoin:master from kriss39:fix-wallettool-create-exit-code changing 2 files +6 −4
  1. kriss39 commented at 9:42 AM on September 26, 2026: contributor

    bitcoin-wallet create exits with status 0 even when the wallet couldn't be created:

    $ bitcoin-wallet -regtest -wallet=w1 create   # first time, ok
    $ bitcoin-wallet -regtest -wallet=w1 create
    Failed to create database path '.../regtest/wallets/w1'. Database already exists.
    $ echo $?
    0
    

    In ExecuteWalletToolFunc the create branch only does something when MakeWallet succeeds and then falls through to return true. The other commands (info, dump, createfromdump) all return false on failure. So scripts that check the exit code think the wallet was created.

    This returns false when MakeWallet fails, the same way info does. The added check in tool_wallet.py runs create on the existing wallet foo and expects exit code 1. It fails on master (not(0 == 1)) and passes with the fix.

  2. DrahtBot added the label Wallet on Sep 26, 2026
  3. DrahtBot commented at 9:42 AM on September 26, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36341.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK maflcko

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. wallet: return error from bitcoin-wallet create
    When MakeWallet fails in the create command, the error is printed but
    ExecuteWalletToolFunc still returns true, so bitcoin-wallet exits with
    status 0. For example, running create twice for the same wallet prints
    "Database already exists." and exits 0. Every other command returns
    false on failure.
    
    Return false when the wallet can't be created, and test that creating
    an existing wallet fails.
    f64d33672f
  5. kriss39 force-pushed on Sep 26, 2026
  6. DrahtBot added the label CI failed on Sep 26, 2026
  7. DrahtBot removed the label CI failed on Sep 26, 2026
  8. maflcko commented at 7:54 AM on September 28, 2026: member

    lgtm ACK f64d33672fe1488b49254a634cbecfd9ce4ca179

Labels

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-09-28 09:51 UTC

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