Skip to content

Commit

Permalink
wallet: fix "null" backup file name and not rolling automatic backup.
Browse files Browse the repository at this point in the history
 New created wallets have no name set by default, thus the `GetUniqueWalletBackupName` function returns "null", and the automatic backup process creates a backup file with a name in the form of "null+date".

Changed the label to "wallet_backup" instead of "null" if the wallet has no name.
  • Loading branch information
furszy committed Nov 3, 2021
1 parent b45ee56 commit e861034
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4371,7 +4371,8 @@ bool CWalletTx::AcceptToMemoryPool(CValidationState& state)

std::string CWallet::GetUniqueWalletBackupName() const
{
return strprintf("%s%s", (!m_name.empty() ? SanitizeString(m_name, SAFE_CHARS_FILENAME) : "null"), FormatISO8601DateTimeForBackup(GetTime()));
std::string name = !m_name.empty() ? SanitizeString(m_name, SAFE_CHARS_FILENAME) : "wallet";
return strprintf("%s%s", name, FormatISO8601DateTimeForBackup(GetTime()));
}

CWallet::CWallet(std::string name, std::unique_ptr<WalletDatabase> database) : m_name(std::move(name)), database(std::move(database))
Expand Down

0 comments on commit e861034

Please sign in to comment.