mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
fix(wallet): autobackup fixes (#5269)
## Issue being fixed or feature implemented pls see individual commits fixes an issue (reported by @strophy recently) where mixing wouldn't start in a fresh new wallet not 100% sure but [99867eb
](99867eb769
) might also fix #5350 reported by @splawik21 so this could also be a v19 backport candidate ## What was done? ## How Has This Been Tested? mixing on testnet ## Breaking Changes ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation **For repository code-owners and collaborators only** - [x] I have assigned this pull request to a milestone
This commit is contained in:
parent
72899530bf
commit
9770e06bfd
@ -336,6 +336,12 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, const std::strin
|
||||
}
|
||||
// end TODO
|
||||
|
||||
// backup the wallet we just encrypted
|
||||
if (!wallet->AutoBackupWallet("", error, warnings) && !error.original.empty()) {
|
||||
status = DatabaseStatus::FAILED_ENCRYPT;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Relock the wallet
|
||||
wallet->Lock();
|
||||
}
|
||||
@ -4864,11 +4870,16 @@ bool CWallet::AutoBackupWallet(const fs::path& wallet_path, bilingual_str& error
|
||||
strWalletName = "wallet.dat";
|
||||
}
|
||||
|
||||
if (!IsBDBFile(BDBDataFile(wallet_path))) {
|
||||
if (!wallet_path.empty() && !IsBDBFile(BDBDataFile(wallet_path))) {
|
||||
WalletLogPrintf("Automatic wallet backups are currently only supported with Berkeley DB!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsWalletFlagSet(WALLET_FLAG_BLANK_WALLET)) {
|
||||
WalletLogPrintf("Wallet is blank, won't create new backup for it!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nWalletBackups <= 0) {
|
||||
WalletLogPrintf("Automatic wallet backups are disabled!\n");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user