mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-19 05:47:26 -04:00
Merge pull request #2012
c2f1d01 main: automatically fix common wallet cache errors (mmbyday)
This commit is contained in:
19
main.qml
19
main.qml
@@ -436,6 +436,23 @@ ApplicationWindow {
|
||||
wizard.wizardState = "wizardHome";
|
||||
rootItem.state = "wizard";
|
||||
}
|
||||
// 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);
|
||||
@@ -443,6 +460,7 @@ ApplicationWindow {
|
||||
closeWallet();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// wallet opened successfully, subscribing for wallet updates
|
||||
connectWallet(wallet)
|
||||
@@ -451,7 +469,6 @@ ApplicationWindow {
|
||||
rootItem.state = "normal";
|
||||
}
|
||||
|
||||
|
||||
function onWalletClosed(walletAddress) {
|
||||
console.log(">>> wallet closed: " + walletAddress)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user