Skip to content

Commit

Permalink
fix bug restoring wrong wallet cache
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Nov 7, 2024
1 parent d85a630 commit bf4c284
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1482,12 +1482,12 @@ private MoneroWalletFull openWalletFull(MoneroWalletConfig config, boolean apply
try {

// rename wallet cache to backup
String cachePath = walletDir.toString() + File.separator + MONERO_WALLET_NAME;
String cachePath = walletDir.toString() + File.separator + getWalletName(config.getPath());
File originalCacheFile = new File(cachePath);
if (originalCacheFile.exists()) originalCacheFile.renameTo(new File(cachePath + ".backup"));

// copy latest wallet cache backup to main folder
File backupCacheFile = FileUtil.getLatestBackupFile(walletDir, MONERO_WALLET_NAME);
File backupCacheFile = FileUtil.getLatestBackupFile(walletDir, getWalletName(config.getPath()));
if (backupCacheFile != null) FileUtil.copyFile(backupCacheFile, new File(cachePath));

// retry opening wallet without original cache
Expand Down Expand Up @@ -1587,12 +1587,12 @@ private MoneroWalletRpc openWalletRpc(MoneroWalletConfig config, Integer port, b
try {

// rename wallet cache to backup
String cachePath = walletDir.toString() + File.separator + MONERO_WALLET_NAME;
String cachePath = walletDir.toString() + File.separator + config.getPath();
File originalCacheFile = new File(cachePath);
if (originalCacheFile.exists()) originalCacheFile.renameTo(new File(cachePath + ".backup"));

// copy latest wallet cache backup to main folder
File backupCacheFile = FileUtil.getLatestBackupFile(walletDir, MONERO_WALLET_NAME);
File backupCacheFile = FileUtil.getLatestBackupFile(walletDir, config.getPath());
if (backupCacheFile != null) FileUtil.copyFile(backupCacheFile, new File(cachePath));

// retry opening wallet without original cache
Expand Down

0 comments on commit bf4c284

Please sign in to comment.