diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index 418dfb96..0cb29915 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -916,9 +916,9 @@ public class LoginActivity extends BaseActivity @Override public boolean createWallet(File aFile, String password) { NodeInfo currentNode = getNode(); - // get it from the connected node if we have one, and go back ca. 4 days + // get it from the connected node if we have one final long restoreHeight = - (currentNode != null) ? currentNode.getHeight() - 2000 : -1; + (currentNode != null) ? currentNode.getHeight() : -1; Wallet newWallet = WalletManager.getInstance() .createWallet(aFile, password, MNEMONIC_LANGUAGE, restoreHeight); return checkAndCloseWallet(newWallet); diff --git a/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java b/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java index 555a1796..f5aa743c 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java +++ b/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java @@ -24,6 +24,7 @@ import com.m2049r.xmrwallet.util.RestoreHeight; import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; import java.util.List; @@ -96,8 +97,11 @@ public class WalletManager { if (wallet.getStatus().isOk()) { // (Re-)Estimate restore height based on what we know final long oldHeight = wallet.getRestoreHeight(); + // Go back 4 days if we don't have a precise restore height + Calendar restoreDate = Calendar.getInstance(); + restoreDate.add(Calendar.DAY_OF_MONTH, -4); final long restoreHeight = - (height > -1) ? height : RestoreHeight.getInstance().getHeight(new Date()); + (height > -1) ? height : RestoreHeight.getInstance().getHeight(restoreDate.getTime()); wallet.setRestoreHeight(restoreHeight); Timber.d("Changed Restore Height from %d to %d", oldHeight, wallet.getRestoreHeight()); wallet.setPassword(password); // this rewrites the keys file (which contains the restore height)