aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-04-03 14:27:34 -0400
committerluigi1111 <luigi1111w@gmail.com>2019-04-03 14:27:34 -0400
commitf3cc2818c5de332c56d4ba8dfdc38d0a88affc5d (patch)
treefd854ef60ac31d9052a8e533be096607c5296c5b
parent91d44702953ee2238539bccef0d29053a909a15e (diff)
parentc2f1d0168b526cf26daf01fee2729fb6d78ecca4 (diff)
downloadmonzero-gui-f3cc2818c5de332c56d4ba8dfdc38d0a88affc5d.tar.gz
monzero-gui-f3cc2818c5de332c56d4ba8dfdc38d0a88affc5d.tar.xz
monzero-gui-f3cc2818c5de332c56d4ba8dfdc38d0a88affc5d.zip
Merge pull request #2012
c2f1d01 main: automatically fix common wallet cache errors (mmbyday)
-rw-r--r--main.qml31
1 files changed, 24 insertions, 7 deletions
diff --git a/main.qml b/main.qml
index 8fe73c43..f460204b 100644
--- a/main.qml
+++ b/main.qml
@@ -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)
}