walletdb: Move BerkeleyDatabase::Flush(true) to Close()

Instead of having Flush optionally shutdown the database and
environment, add a Close() function that does that.
This commit is contained in:
Andrew Chow
2020-06-15 17:59:24 -04:00
parent 834ac4c0f5
commit 27b2766384
6 changed files with 41 additions and 30 deletions

View File

@@ -17,7 +17,7 @@ namespace WalletTool {
static void WalletToolReleaseWallet(CWallet* wallet)
{
wallet->WalletLogPrintf("Releasing wallet\n");
wallet->Flush(true);
wallet->Close();
delete wallet;
}
@@ -133,7 +133,7 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
std::shared_ptr<CWallet> wallet_instance = CreateWallet(name, path);
if (wallet_instance) {
WalletShowInfo(wallet_instance.get());
wallet_instance->Flush(true);
wallet_instance->Close();
}
} else if (command == "info" || command == "salvage") {
if (!fs::exists(path)) {
@@ -145,7 +145,7 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
std::shared_ptr<CWallet> wallet_instance = LoadWallet(name, path);
if (!wallet_instance) return false;
WalletShowInfo(wallet_instance.get());
wallet_instance->Flush(true);
wallet_instance->Close();
} else if (command == "salvage") {
return SalvageWallet(path);
}