diff options
| author | Riccardo Spagni <ric@spagni.net> | 2016-11-11 12:46:15 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2016-11-11 12:46:15 +0200 |
| commit | 75608f1772ec999b9513de76773372192c667f16 (patch) | |
| tree | a6080db182e34e9a5a6ffe0d5a0ee4439a4e97f7 | |
| parent | 573049d871b6de895eca94a3f46884eaece07ae9 (diff) | |
| parent | 4e61ebeedb466710c59c382aa348f54a08cb8bf5 (diff) | |
| download | monzero-gui-75608f1772ec999b9513de76773372192c667f16.tar.gz monzero-gui-75608f1772ec999b9513de76773372192c667f16.tar.xz monzero-gui-75608f1772ec999b9513de76773372192c667f16.zip | |
Merge pull request #143
4e61ebe add default argument to store() (Jacob Brydolf)
7c9d223 remove unnecessary i/o (Jacob Brydolf)
| -rw-r--r-- | main.qml | 17 | ||||
| -rw-r--r-- | src/libwalletqt/Wallet.h | 3 |
2 files changed, 12 insertions, 8 deletions
@@ -289,13 +289,16 @@ ApplicationWindow { daemonSynced = (currentWallet.connected != Wallet.ConnectionStatus_Disconnected && dCurrentBlock >= dTargetBlock) - - // Store wallet after every refresh. + // Refresh is succesfull if blockchain height > 1 if (currentWallet.blockChainHeight() > 1){ - //TODO: Doesn't need path after creation. Change libwalletqt - currentWallet.store("") - console.log("Saving wallet"); + // Save new wallet after first refresh + // Wallet is nomrmally saved to disk on app exit. This prevents rescan from block 0 after app crash + if(isNewWallet){ + console.log("Saving wallet after first refresh"); + currentWallet.store() + isNewWallet = false + } // recovering from seed is finished after first refresh if(persistentSettings.is_recovering) { @@ -303,7 +306,6 @@ ApplicationWindow { } } - isNewWallet = false // initialize transaction history once wallet is initializef first time; if (!walletInitialized) { @@ -978,6 +980,7 @@ ApplicationWindow { } } onClosing: { - //walletManager.closeWallet(currentWallet); + // Close and save to disk on app close + walletManager.closeWallet(currentWallet); } } diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index 74c4fea1..fc7363e8 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -79,7 +79,8 @@ public: QString address() const; //! saves wallet to the file by given path - Q_INVOKABLE bool store(const QString &path); + //! empty path stores in current location + Q_INVOKABLE bool store(const QString &path = ""); //! initializes wallet Q_INVOKABLE bool init(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering = false, quint64 restoreHeight = 0); |
