Provider refusals
write_verifier: Provider declined the request because of a cybersecurity restriction. Experiments remain incomplete; static verification can continue.
2 major findings · 1 minor finding · 1 suggestion
Findings
[major] · Leftover sweep deletes unrelated wallets under migration/*.tmp
Migrating a default or top-level plain-file legacy wallet can erase an unrelated wallet named migration/savings.tmp; no current caller was found that generates this unusual name automatically.
Location: src/wallet/wallet.cpp:3794 (head).
Details and suggested fix
GetWalletPath() accepts nested wallet names, so a user can create and unload a descriptor wallet named migration/savings.tmp. Migrating the unnamed default wallet or a top-level plain-file legacy wallet then uses <walletdir>/migration as migration_dir. On success, RemoveMigrationLeftovers() selects every real *.tmp subdirectory and removes its wallet.dat and journal without checking who created them. This deletes the unrelated wallet's private-key database, which the legacy wallet's migration backup cannot recover. Remove the sweep and restrict cleanup to a staging directory created exclusively for this invocation. Add a regression test that preserves an unloaded migration/<x>.tmp wallet.
[major] · Failed concurrent creation can delete the winning wallet's database
On POSIX, racing duplicate wallet creates can make the losing attempt unlink the winner's database; this requires a narrow interleaving, and no current caller was found that routinely issues concurrent creates for the same path.
Location: src/wallet/sqlite.cpp:722 (head).
Details and suggested fix
Two trusted createwallet requests can pass the non-reserving require_create check before either creates the database. If B snapshots the paths as missing and pauses while A creates and locks the wallet, B subsequently fails at BEGIN EXCLUSIVE. Its exception handler then removes A's wallet.dat and journal because they were missing at snapshot time, not because B owns them. POSIX permits this while A still has the files open, potentially losing its persisted keys when those handles close unless a backup exists. Windows normally refuses deletion of open files. Remove ownership-free cleanup from generic MakeSQLiteDatabase() and perform it only for a location the caller created exclusively. Add a deterministic concurrent-create regression test.
[minor] · A plain-file wallet named migration blocks its own migration
A valid top-level BDB wallet file named migration now blocks its own staging path, so migration fails on every retry until the file is renamed; the original wallet remains intact.
Location: src/wallet/wallet.cpp:3847 (head).
Details and suggested fix
For this accepted legacy wallet name, move_dir is true and migration_dir becomes <walletdir>/migration, which is the wallet file itself. temp_dir therefore requires a directory beneath a regular file, and database creation fails before reaching the swap. The base implementation could migrate this name because it removed the file before creating the replacement directory. Stage in a uniquely named sibling directory created exclusively and distinct from the wallet path. Include the literal name migration in the plain-file regression tests.
Optional improvements
[suggestion] · Interrupted migrations expose staging databases as available wallets
An interrupted migration can leave staging databases offered by listwalletdir and the GUI open menu, confusing recovery, although completed copies retaining legacy FLAGS are rejected on load.
Location: src/wallet/wallet.cpp:3849 (head).
Details and suggested fix
For wallets inside the wallet directory, staging creates a recursively discoverable .tmp/wallet.dat. SQLite initialization sets the application ID before the record-copy transaction, so IsSQLiteFile() recognizes the staging database without checking migration completeness. A crash after initialization but before the swap bypasses normal cleanup, leaving entries such as migration/foo_<time>.tmp until manual cleanup or a later successful migration in that directory. Use a staging filename that wallet discovery does not recognize, then rename it during the swap while keeping staging on the same filesystem. Do not exclude all .tmp directories from discovery, since those can contain legitimate user wallets.