Skip to content

Commit

Permalink
Add lock before wallet backup (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored Jan 13, 2023
1 parent 3814bd7 commit 26f8834
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wallet/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@ void MaybeCompactWalletDB()

void AutoBackupWallet() {
for (const std::shared_ptr<CWallet> &pwallet: GetWallets()) {
auto locked_chain = pwallet->chain().lock();
LOCK2(pwallet->cs_wallet, locked_chain->mutex());

auto env = pwallet->GetDBHandle().env;
std::string walletName = pwallet->GetName().empty() ? "default" : pwallet->GetName();
fs::path prevBackup = env->Directory() / strprintf("auto.backup.%s.bak1", walletName);
Expand Down

0 comments on commit 26f8834

Please sign in to comment.