aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmbyday <mmbyday@protonmail.com>2019-03-12 00:25:46 -0700
committermmbyday <mmbyday@protonmail.com>2019-03-12 00:25:46 -0700
commitc2f1d0168b526cf26daf01fee2729fb6d78ecca4 (patch)
tree044b6e63ce46ed076d163172b1f77723983d9200
parente729cd233cc939876e6e8529d340cd9f88b9b22b (diff)
downloadmonzero-gui-c2f1d0168b526cf26daf01fee2729fb6d78ecca4.tar.gz
monzero-gui-c2f1d0168b526cf26daf01fee2729fb6d78ecca4.tar.xz
monzero-gui-c2f1d0168b526cf26daf01fee2729fb6d78ecca4.zip
main: automatically fix common wallet cache errors
-rw-r--r--main.qml33
1 files changed, 25 insertions, 8 deletions
diff --git a/main.qml b/main.qml
index b3d0e528..e694fd84 100644
--- a/main.qml
+++ b/main.qml
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
@@ -436,12 +436,30 @@ ApplicationWindow {
wizard.wizardState = "wizardHome";
rootItem.state = "wizard";
}
- // opening with password but password doesn't match
- console.error("Error opening wallet with password: ", wallet.errorString);
- passwordDialog.showError(qsTr("Couldn't open wallet: ") + wallet.errorString);
- console.log("closing wallet async : " + wallet.address)
- closeWallet();
- return;
+ // try to resolve common wallet cache errors automatically
+ switch (wallet.errorString) {
+ case "basic_string::_M_replace_aux":
+ walletManager.clearWalletCache(wallet.path);
+ walletPassword = passwordDialog.password;
+ appWindow.initialize();
+ console.error("Repairing wallet cache with error: ", wallet.errorString);
+ appWindow.showStatusMessage(qsTr("Repairing incompatible wallet cache. Resyncing wallet."),6);
+ return;
+ case "std::bad_alloc":
+ walletManager.clearWalletCache(wallet.path);
+ walletPassword = passwordDialog.password;
+ appWindow.initialize();
+ console.error("Repairing wallet cache with error: ", wallet.errorString);
+ appWindow.showStatusMessage(qsTr("Repairing incompatible wallet cache. Resyncing wallet."),6);
+ return;
+ default:
+ // opening with password but password doesn't match
+ console.error("Error opening wallet with password: ", wallet.errorString);
+ passwordDialog.showError(qsTr("Couldn't open wallet: ") + wallet.errorString);
+ console.log("closing wallet async : " + wallet.address)
+ closeWallet();
+ return;
+ }
}
// wallet opened successfully, subscribing for wallet updates
@@ -451,7 +469,6 @@ ApplicationWindow {
rootItem.state = "normal";
}
-
function onWalletClosed(walletAddress) {
console.log(">>> wallet closed: " + walletAddress)
}