File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -4336,7 +4336,7 @@ util::Result<MigrationResult> MigrateLegacyToDescriptor(const std::string& walle
4336
4336
4337
4337
// Make a backup of the DB
4338
4338
fs::path this_wallet_dir = fs::absolute (fs::PathFromString (local_wallet->GetDatabase ().Filename ())).parent_path ();
4339
- fs::path backup_filename = fs::PathFromString (strprintf (" %s- %d.legacy.bak" , wallet_name, GetTime ()));
4339
+ fs::path backup_filename = fs::PathFromString (strprintf (" %s_ %d.legacy.bak" , ( wallet_name. empty () ? " default_wallet " : wallet_name) , GetTime ()));
4340
4340
fs::path backup_path = this_wallet_dir / backup_filename;
4341
4341
if (!local_wallet->BackupWallet (fs::PathToString (backup_path))) {
4342
4342
if (was_loaded) {
Original file line number Diff line number Diff line change @@ -529,11 +529,20 @@ def test_default_wallet(self):
529
529
self .log .info ("Test migration of the wallet named as the empty string" )
530
530
wallet = self .create_legacy_wallet ("" )
531
531
532
- self .migrate_wallet (wallet )
532
+ # Set time to verify backup existence later
533
+ curr_time = int (time .time ())
534
+ wallet .setmocktime (curr_time )
535
+
536
+ res = self .migrate_wallet (wallet )
533
537
info = wallet .getwalletinfo ()
534
538
assert_equal (info ["descriptors" ], True )
535
539
assert_equal (info ["format" ], "sqlite" )
536
540
541
+ # Check backup existence and its non-empty wallet filename
542
+ backup_path = self .nodes [0 ].wallets_path / f'default_wallet_{ curr_time } .legacy.bak'
543
+ assert backup_path .exists ()
544
+ assert_equal (str (backup_path ), res ['backup_path' ])
545
+
537
546
def test_direct_file (self ):
538
547
self .log .info ("Test migration of a wallet that is not in a wallet directory" )
539
548
wallet = self .create_legacy_wallet ("plainfile" )
You can’t perform that action at this time.
0 commit comments