mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-21 03:14:05 +02:00
qa: Remove all instances of remove_all except test cleanup
Adds a lint check for `remove_all()` `fs::remove_all()`/`std::filesystem::remove_all()` is extremely dangerous, all user-facing instances of it have been removed, and it also deserves to be removed from the places in our test code where it is being used unnecessarily.
This commit is contained in:
@@ -44,16 +44,19 @@ static void WalletCreate(benchmark::Bench& bench, bool encrypted)
|
||||
bilingual_str error_string;
|
||||
std::vector<bilingual_str> warnings;
|
||||
|
||||
auto wallet_path = fs::PathToString(test_setup->m_path_root / "test_wallet");
|
||||
const auto wallet_path = test_setup->m_path_root / "test_wallet";
|
||||
const auto wallet_name = fs::PathToString(wallet_path);
|
||||
|
||||
bench.run([&] {
|
||||
auto wallet = CreateWallet(context, wallet_path, /*load_on_start=*/std::nullopt, options, status, error_string, warnings);
|
||||
auto wallet = CreateWallet(context, wallet_name, /*load_on_start=*/std::nullopt, options, status, error_string, warnings);
|
||||
assert(status == DatabaseStatus::SUCCESS);
|
||||
assert(wallet != nullptr);
|
||||
|
||||
// Release wallet
|
||||
RemoveWallet(context, wallet, /*load_on_start=*/ std::nullopt);
|
||||
WaitForDeleteWallet(std::move(wallet));
|
||||
fs::remove_all(wallet_path);
|
||||
fs::remove(wallet_path / "wallet.dat");
|
||||
fs::remove(wallet_path);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user