Repository navigation
backport: bitcoin/bitcoin#28609, #34215, #34226, #34370, partials #31423, #34156 (migratewallet fixes from 28.x) #8014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8a922f1
3fd819a
c8f51bb
cfd0412
7b7d0c6
9857f73
1574eb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,11 +280,17 @@ bool CreateFromDump(const ArgsManager& args, const std::string& name, const fs:: | |
|
|
||
| dump_file.close(); | ||
| } | ||
| // On failure, gather the paths to remove | ||
| std::vector<fs::path> paths_to_remove = wallet->GetDatabase().Files(); | ||
| if (!name.empty()) paths_to_remove.push_back(wallet_path); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For a named AGENTS.md reference: AGENTS.md:L54-L56 Useful? React with 👍 / 👎. |
||
|
|
||
| wallet.reset(); // The pointer deleter will close the wallet for us. | ||
|
|
||
| // Remove the wallet dir if we have a failure | ||
| if (!ret) { | ||
| fs::remove_all(wallet_path); | ||
| for (const auto& p : paths_to_remove) { | ||
| fs::remove(p); | ||
| } | ||
| } | ||
|
|
||
| return ret; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a BDB target has
databaseas a symlink to another directory,is_directoryand this iterator follow the link, so every target entry namedlog.*is returned fromFiles()and subsequently deleted by the failed-create cleanup indump.cpp. SinceMakeDatabaseaccepts this on-disk layout, a bad dump import can erase files outside the wallet path; usesymlink_statusand fall back to removing only the wallet data file when the log directory is a symlink.AGENTS.md reference: AGENTS.md:L54-L56
Useful? React with 👍 / 👎.