mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-09 12:30:10 +00:00
main: automatically fix common wallet cache errors
This commit is contained in:
parent
e729cd233c
commit
c2f1d0168b
1 changed files with 25 additions and 8 deletions
33
main.qml
33
main.qml
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2014-2018, The Monero Project
|
// Copyright (c) 2014-2019, The Monero Project
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
|
@ -436,12 +436,30 @@ ApplicationWindow {
|
||||||
wizard.wizardState = "wizardHome";
|
wizard.wizardState = "wizardHome";
|
||||||
rootItem.state = "wizard";
|
rootItem.state = "wizard";
|
||||||
}
|
}
|
||||||
// opening with password but password doesn't match
|
// try to resolve common wallet cache errors automatically
|
||||||
console.error("Error opening wallet with password: ", wallet.errorString);
|
switch (wallet.errorString) {
|
||||||
passwordDialog.showError(qsTr("Couldn't open wallet: ") + wallet.errorString);
|
case "basic_string::_M_replace_aux":
|
||||||
console.log("closing wallet async : " + wallet.address)
|
walletManager.clearWalletCache(wallet.path);
|
||||||
closeWallet();
|
walletPassword = passwordDialog.password;
|
||||||
return;
|
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
|
// wallet opened successfully, subscribing for wallet updates
|
||||||
|
@ -451,7 +469,6 @@ ApplicationWindow {
|
||||||
rootItem.state = "normal";
|
rootItem.state = "normal";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onWalletClosed(walletAddress) {
|
function onWalletClosed(walletAddress) {
|
||||||
console.log(">>> wallet closed: " + walletAddress)
|
console.log(">>> wallet closed: " + walletAddress)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue