1 minor finding · 1 suggestion
Earlier concerns neither republished nor resolved: 1 minor finding · 2 suggestions. See the Run archive for their assessments.
Findings
[minor] · Failed creation can unlink a concurrently opened wallet
On POSIX, narrowly timed conflicting wallet operations from trusted clients can let failed-creation cleanup unlink another operation's open database, leaving it unavailable after unload or restart.
Location: src/wallet/wallet.cpp:399 (head).
Details and suggested fix
When external-signer setup fails, CreateNew destroys its local wallet and closes SQLite before this removal loop runs. The exclusive database lock has already been released, but cleanup still relies on the earlier existence snapshot. CreateWallet does not participate in LoadWallet's name reservation. A concurrent loadwallet can therefore open the initialized partial watch-only wallet, which has no descriptors, between close and unlink. A concurrent createwallet can also succeed if it passed the existing-database check before the first attempt wrote the header and then remained delayed across the signer call until the first connection closed. Cleanup can then unlink its database, including newly generated private-key descriptors, while it remains open. POSIX permits this unlink; removing the now-empty directory can also prevent subsequent journal creation. Reserve the wallet path across the snapshot, creation, close and cleanup, with both loads and creates using the same reservation. Use a resolved-path key to cover relative and absolute aliases. These scheduling windows are very small, and no current client issuing such conflicting same-name operations was identified, so production impact is unconfirmed.
Optional improvements
[suggestion] · Failed-creation cleanup silently discards removal errors
If removing an initialized wallet.dat fails, the user sees only the setup error, and retrying reports “Database already exists” without explaining the failed cleanup.
Location: src/wallet/wallet.cpp:399 (head).
Details and suggested fix
Each fs::remove call overwrites ec, but nothing checks or logs it. For example, if permissions change after database creation and wallet.dat cannot be removed, the recognized SQLite file remains and blocks a retry. Check ec immediately after each file and directory removal and LogWarning the affected path and ec.message(). Keep the non-throwing overloads, original setup error, FAILED_CREATE status and current deletion scope. This follows the existing non-throwing filesystem diagnostic pattern in IsSQLiteFile; an absent journal does not produce an error.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: Failed-creation cleanup deletes a pre-existing dangling wallet.dat symlink (earlier report)
- [suggestion]: Pre-existing-file test leaves the blocked wallet name unasserted (earlier report)
- [suggestion]: External-signer creation changes lack a release note (earlier report)