mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-04 06:12:07 +01:00
Bugfix: Wallet/Migration: Move backup into wallet directory when migrating from non-directory
While 30.x+ keep backup files in walletdir, 29.x places them in the migrated wallet directory
This commit is contained in:
@@ -4581,6 +4581,12 @@ util::Result<MigrationResult> MigrateLegacyToDescriptor(std::shared_ptr<CWallet>
|
||||
// First change to using SQLite
|
||||
if (!local_wallet->MigrateToSQLite(error)) return util::Error{error};
|
||||
|
||||
// In case we're migrating from file to directory, move the backup into it
|
||||
this_wallet_dir = fs::absolute(fs::PathFromString(local_wallet->GetDatabase().Filename())).parent_path();
|
||||
backup_path = this_wallet_dir / backup_filename;
|
||||
fs::rename(res.backup_path, backup_path);
|
||||
res.backup_path = backup_path;
|
||||
|
||||
// Do the migration of keys and scripts for non-blank wallets, and cleanup if it fails
|
||||
success = local_wallet->IsWalletFlagSet(WALLET_FLAG_BLANK_WALLET);
|
||||
if (!success) {
|
||||
|
||||
Reference in New Issue
Block a user