Merge pull request #143

4e61ebe add default argument to store() (Jacob Brydolf)
7c9d223 remove unnecessary i/o (Jacob Brydolf)
This commit is contained in:
Riccardo Spagni 2016-11-11 12:46:15 +02:00
commit 75608f1772
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
2 changed files with 12 additions and 8 deletions

View file

@ -289,13 +289,16 @@ ApplicationWindow {
daemonSynced = (currentWallet.connected != Wallet.ConnectionStatus_Disconnected && dCurrentBlock >= dTargetBlock) daemonSynced = (currentWallet.connected != Wallet.ConnectionStatus_Disconnected && dCurrentBlock >= dTargetBlock)
// Refresh is succesfull if blockchain height > 1
// Store wallet after every refresh.
if (currentWallet.blockChainHeight() > 1){ if (currentWallet.blockChainHeight() > 1){
//TODO: Doesn't need path after creation. Change libwalletqt // Save new wallet after first refresh
currentWallet.store("") // Wallet is nomrmally saved to disk on app exit. This prevents rescan from block 0 after app crash
console.log("Saving wallet"); if(isNewWallet){
console.log("Saving wallet after first refresh");
currentWallet.store()
isNewWallet = false
}
// recovering from seed is finished after first refresh // recovering from seed is finished after first refresh
if(persistentSettings.is_recovering) { if(persistentSettings.is_recovering) {
@ -303,7 +306,6 @@ ApplicationWindow {
} }
} }
isNewWallet = false
// initialize transaction history once wallet is initializef first time; // initialize transaction history once wallet is initializef first time;
if (!walletInitialized) { if (!walletInitialized) {
@ -978,6 +980,7 @@ ApplicationWindow {
} }
} }
onClosing: { onClosing: {
//walletManager.closeWallet(currentWallet); // Close and save to disk on app close
walletManager.closeWallet(currentWallet);
} }
} }

View file

@ -79,7 +79,8 @@ public:
QString address() const; QString address() const;
//! saves wallet to the file by given path //! 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 //! initializes wallet
Q_INVOKABLE bool init(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering = false, quint64 restoreHeight = 0); Q_INVOKABLE bool init(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering = false, quint64 restoreHeight = 0);