mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 13:32:33 +02:00
assumeutxo: catch and log fs::remove error instead of two exist checks
This commit is contained in:
parent
b4fb0a3255
commit
0e21b56a44
@ -4859,15 +4859,15 @@ static bool DeleteCoinsDBFromDisk(const fs::path db_path, bool is_snapshot)
|
|||||||
if (is_snapshot) {
|
if (is_snapshot) {
|
||||||
fs::path base_blockhash_path = db_path / node::SNAPSHOT_BLOCKHASH_FILENAME;
|
fs::path base_blockhash_path = db_path / node::SNAPSHOT_BLOCKHASH_FILENAME;
|
||||||
|
|
||||||
if (fs::exists(base_blockhash_path)) {
|
try {
|
||||||
bool removed = fs::remove(base_blockhash_path);
|
bool existed = fs::remove(base_blockhash_path);
|
||||||
if (!removed) {
|
if (!existed) {
|
||||||
LogPrintf("[snapshot] failed to remove file %s\n",
|
LogPrintf("[snapshot] snapshot chainstate dir being removed lacks %s file\n",
|
||||||
fs::PathToString(base_blockhash_path));
|
fs::PathToString(node::SNAPSHOT_BLOCKHASH_FILENAME));
|
||||||
}
|
}
|
||||||
} else {
|
} catch (const fs::filesystem_error& e) {
|
||||||
LogPrintf("[snapshot] snapshot chainstate dir being removed lacks %s file\n",
|
LogPrintf("[snapshot] failed to remove file %s: %s\n",
|
||||||
fs::PathToString(node::SNAPSHOT_BLOCKHASH_FILENAME));
|
fs::PathToString(base_blockhash_path), fsbridge::get_filesystem_error_message(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user