diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index bd5fd605eed..20389ba87d5 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -2935,6 +2935,10 @@ seed.warn.walletNotEmpty.emptyWallet=I will empty my wallets first seed.warn.notEncryptedAnymore=Your wallets are encrypted.\n\n\ After restore, the wallets will no longer be encrypted and you must set a new password.\n\n\ Do you want to proceed? +seed.warn.walletDateEmpty=As you have not specified a wallet date, bisq will have to scan the blockchain from 2013.10.09 (the BIP39 epoch date).\n\n\ +BIP39 wallets were first introduced in bisq on 2017.06.28 (release v0.5). So you could save time by using that date.\n\n\ +Ideally you should specify the date your wallet seed was created.\n\n\n\ +Are you sure you want to go ahead without specifying a wallet date? seed.restore.success=Wallets restored successfully with the new seed words.\n\nYou need to shut down and restart the application. seed.restore.error=An error occurred when restoring the wallets with seed words.{0} diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/seedwords/SeedWordsView.java b/desktop/src/main/java/bisq/desktop/main/account/content/seedwords/SeedWordsView.java index 4487cdc7b8a..13c9bc49ee2 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/seedwords/SeedWordsView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/seedwords/SeedWordsView.java @@ -239,6 +239,19 @@ private void onRestore() { private void checkIfEncrypted() { if (walletsManager.areWalletsEncrypted()) { new Popup().information(Res.get("seed.warn.notEncryptedAnymore")) + .closeButtonText(Res.get("shared.no")) + .actionButtonText(Res.get("shared.yes")) + .onAction(this::doRestoreDateCheck) + .show(); + } else { + doRestoreDateCheck(); + } + } + + private void doRestoreDateCheck() { + if (restoreDatePicker.getValue() == null) { + // Provide feedback when attempting to restore a wallet from seed words without specifying a date + new Popup().information(Res.get("seed.warn.walletDateEmpty")) .closeButtonText(Res.get("shared.no")) .actionButtonText(Res.get("shared.yes")) .onAction(this::doRestore) @@ -248,7 +261,7 @@ private void checkIfEncrypted() { } } - private void doRestore() { + private LocalDate getWalletDate() { LocalDate walletDate = restoreDatePicker.getValue(); // Even though no current Bisq wallet could have been created before the v0.5 release date (2017.06.28), // the user may want to import from a seed generated by another wallet. @@ -264,7 +277,11 @@ private void doRestore() { } else if (walletDate.isAfter(LocalDate.now())) { walletDate = LocalDate.now(); } + return walletDate; + } + private void doRestore() { + LocalDate walletDate = getWalletDate(); // We subtract 1 day to be sure to not have any issues with timezones. Even if we can be sure that the timezone // is handled correctly it could be that the user created the wallet in one timezone and make a restore at // a different timezone which could lead in the worst case that he miss the first day of the wallet transactions.