Allow restore from seednode if wallet is not empty

This commit is contained in:
Manfred Karrer 2016-04-17 20:39:20 +02:00
parent 6726504bd0
commit b889e9dc14
5 changed files with 33 additions and 13 deletions

View File

@ -76,7 +76,7 @@ import static io.bitsquare.app.BitsquareEnvironment.APP_NAME_KEY;
public class BitsquareApp extends Application {
private static final Logger log = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(BitsquareApp.class);
public static final boolean DEV_MODE = false;
public static final boolean DEV_MODE = true;
public static final boolean IS_RELEASE_VERSION = !DEV_MODE && true;
private static Environment env;

View File

@ -237,13 +237,25 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
"Please finalize your trades, close all your open offers and go to the Funds section to withdraw your bitcoin.\n" +
"In case you cannot access your bitcoin you can use the emergency tool to empty the wallet.\n" +
"To open that emergency tool press \"cmd + e\".")
.actionButtonText("I want to restore anyway")
.onAction(this::checkIfEncrypted)
.closeButtonText("I will empty my wallet first")
.show();
} else if (wallet.isEncrypted()) {
} else {
checkIfEncrypted();
}
}
private void checkIfEncrypted() {
if (walletService.getWallet().isEncrypted()) {
new Popup()
.warning("Your bitcoin wallet is encrypted.\n\n" +
"After restore, the wallet will no longer be encrypted and you must set a new password.")
.closeButtonText("I understand")
.onClose(() -> doRestore()).show();
.information("Your bitcoin wallet is encrypted.\n\n" +
"After restore, the wallet will no longer be encrypted and you must set a new password.\n\n" +
"Do you want to proceed?")
.closeButtonText("No")
.actionButtonText("Yes")
.onAction(this::doRestore)
.show();
} else {
doRestore();
}
@ -253,7 +265,7 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
log.info("Attempting wallet restore using seed '{}' from date {}", restoreSeedWordsTextArea.getText(), restoreDatePicker.getValue());
long date = restoreDatePicker.getValue().atStartOfDay().toEpochSecond(ZoneOffset.UTC);
DeterministicSeed seed = new DeterministicSeed(Splitter.on(" ").splitToList(restoreSeedWordsTextArea.getText()), null, "", date);
walletService.restoreSeedWords(seed,
walletService.restoreSeedWords(seed,
() -> UserThread.execute(() -> {
log.debug("Wallet restored with seed words");
@ -261,7 +273,7 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
.feedback("Wallet restored successfully with the new seed words.\n\n" +
"You need to shut down and restart the application.")
.closeButtonText("Shut down")
.onClose(() -> BitsquareApp.shutDownHandler.run()).show();
.onClose(BitsquareApp.shutDownHandler::run).show();
}),
throwable -> UserThread.execute(() -> {
log.error(throwable.getMessage());

View File

@ -159,7 +159,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
amountLabel = amountTuple.first;
amountTextField = amountTuple.second;
if (BitsquareApp.DEV_MODE)
amountTextField.setText("1");
amountTextField.setText("10");
titledGroupBg.setVisible(false);
titledGroupBg.setManaged(false);

View File

@ -148,8 +148,7 @@ public class TransactionsListItem {
} else if (trade.getPayoutTx() != null &&
trade.getPayoutTx().getHashAsString().equals(txId)) {
details = "MultiSig payout: " + tradable.getShortId();
} else if (trade.getDisputeState() == Trade.DisputeState.DISPUTE_CLOSED ||
trade.getDisputeState() == Trade.DisputeState.DISPUTE_STARTED_BY_PEER) {
} else if (trade.getDisputeState() != Trade.DisputeState.NONE) {
if (valueSentToMe.isPositive()) {
details = "Dispute payout: " + tradable.getShortId();
} else {

View File

@ -334,10 +334,19 @@ public class WalletPasswordWindow extends Overlay<WalletPasswordWindow> {
"Please finalize your trades, close all your open offers and go to the Funds section to withdraw your bitcoin.\n" +
"In case you cannot access your bitcoin you can use the emergency tool to empty the wallet.\n" +
"To open that emergency tool press \"cmd + e\".")
.actionButtonText("I want to restore anyway")
.onAction(this::checkIfEncrypted)
.closeButtonText("I will empty my wallet first")
.show();
} else if (wallet.isEncrypted()) {
} else {
checkIfEncrypted();
}
}
private void checkIfEncrypted() {
if (walletService.getWallet().isEncrypted()) {
new Popup()
.warning("Your bitcoin wallet is encrypted.\n\n" +
.information("Your bitcoin wallet is encrypted.\n\n" +
"After restore, the wallet will no longer be encrypted and you must set a new password.\n\n" +
"Do you want to proceed?")
.closeButtonText("No")