AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 24 Bitcoin

Merge bitcoin/bitcoin#36341: wallet: return error from bitcoin-wallet create

Public commit record

What the developer wrote

Authored by merge-script

81/100 · Strong
Merge bitcoin/bitcoin#36341: wallet: return error from bitcoin-wallet create

f64d33672fe1488b49254a634cbecfd9ce4ca179 wallet: return error from bitcoin-wallet create (Kanan)

Pull request description:

`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.

ACKs for top commit:
maflcko:
lgtm ACK f64d33672fe1488b49254a634cbecfd9ce4ca179
sedited:
ACK f64d33672fe1488b49254a634cbecfd9ce4ca179

Tree-SHA512: aa2404a4bea38ca53da989d0b09e13a6b48dccfd49fa0e70a268c325241226693a8ca6ef94fb35cc0cca2cc66a066dcf90adfc254e972e4b9b23c047adefaf3f
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This is a small reliability fix for the bitcoin-wallet command-line tool. Previously, when you tried to create a wallet that already existed, the tool printed an error message but still exited with status 0, which is the code normally used for success. Scripts and automated tools checking the exit code would therefore incorrectly think the command succeeded. The patch makes the tool return a non-zero exit code on failure, matching the behavior of other wallet tool commands. There is no security vulnerability allowing theft, remote attack, or code execution.

Recommended action

No urgent action required. This is a minor correctness/reliability improvement. Users relying on bitcoin-wallet create in scripts should upgrade to a release containing this fix to ensure proper error detection, but there is no immediate security risk.

Security signals we found

01

Incorrect exit status on failure (success/failure confusion)

02

Command-line tool behavior inconsistent with other commands

03

Potential for scripts to misinterpret failed wallet creation as successful

Risk score

Why this scored 24/100

Our methodology →
Potential impact 3/30
Exploitability 0/25
Stealth signal 2/15
Affected reach 5/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.