diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-08-22 15:53:07 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-08-22 22:47:59 +0300 |
commit | b1a5a937ff6177723c729f94624e282351de27bb (patch) | |
tree | 05dde200561f9c21942411165f86a97e9bedb451 /src | |
parent | Merge pull request #963 (diff) | |
download | monero-b1a5a937ff6177723c729f94624e282351de27bb.tar.xz |
libwallet_api: do not store wallet on close if status is not ok
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/api/wallet.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 4b97e2f1d..ff74ec6c1 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -267,16 +267,18 @@ bool WalletImpl::recover(const std::string &path, const std::string &seed) bool WalletImpl::close() { - clearStatus(); + bool result = false; try { - // LOG_PRINT_L0("Calling wallet::store..."); - m_wallet->store(); + // do not store wallet with invalid status + if (status() == Status_Ok) + m_wallet->store(); // LOG_PRINT_L0("wallet::store done"); // LOG_PRINT_L0("Calling wallet::stop..."); m_wallet->stop(); // LOG_PRINT_L0("wallet::stop done"); result = true; + clearStatus(); } catch (const std::exception &e) { m_status = Status_Error; m_errorString = e.what(); |