From b1a5a937ff6177723c729f94624e282351de27bb Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Mon, 22 Aug 2016 15:53:07 +0300 Subject: libwallet_api: do not store wallet on close if status is not ok --- src/wallet/api/wallet.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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(); -- cgit v1.2.3