Merge pull request #2289
6ee1116d
store is optional during close and defaults to true; except during descruction (m2049r)
This commit is contained in:
commit
40d213154b
|
@ -303,7 +303,7 @@ WalletImpl::~WalletImpl()
|
||||||
// Pause refresh thread - prevents refresh from starting again
|
// Pause refresh thread - prevents refresh from starting again
|
||||||
pauseRefresh();
|
pauseRefresh();
|
||||||
// Close wallet - stores cache and stops ongoing refresh operation
|
// Close wallet - stores cache and stops ongoing refresh operation
|
||||||
close();
|
close(false); // do not store wallet as part of the closing activities
|
||||||
// Stop refresh thread
|
// Stop refresh thread
|
||||||
stopRefresh();
|
stopRefresh();
|
||||||
delete m_wallet2Callback;
|
delete m_wallet2Callback;
|
||||||
|
@ -566,19 +566,21 @@ bool WalletImpl::recover(const std::string &path, const std::string &seed)
|
||||||
return m_status == Status_Ok;
|
return m_status == Status_Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletImpl::close()
|
bool WalletImpl::close(bool store)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
LOG_PRINT_L1("closing wallet...");
|
LOG_PRINT_L1("closing wallet...");
|
||||||
try {
|
try {
|
||||||
// Do not store wallet with invalid status
|
if (store) {
|
||||||
// Status Critical refers to errors on opening or creating wallets.
|
// Do not store wallet with invalid status
|
||||||
if (status() != Status_Critical)
|
// Status Critical refers to errors on opening or creating wallets.
|
||||||
m_wallet->store();
|
if (status() != Status_Critical)
|
||||||
else
|
m_wallet->store();
|
||||||
LOG_ERROR("Status_Critical - not storing wallet");
|
else
|
||||||
LOG_PRINT_L1("wallet::store done");
|
LOG_ERROR("Status_Critical - not storing wallet");
|
||||||
|
LOG_PRINT_L1("wallet::store done");
|
||||||
|
}
|
||||||
LOG_PRINT_L1("Calling wallet::stop...");
|
LOG_PRINT_L1("Calling wallet::stop...");
|
||||||
m_wallet->stop();
|
m_wallet->stop();
|
||||||
LOG_PRINT_L1("wallet::stop done");
|
LOG_PRINT_L1("wallet::stop done");
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
const std::string &address_string,
|
const std::string &address_string,
|
||||||
const std::string &viewkey_string,
|
const std::string &viewkey_string,
|
||||||
const std::string &spendkey_string = "");
|
const std::string &spendkey_string = "");
|
||||||
bool close();
|
bool close(bool store = true);
|
||||||
std::string seed() const;
|
std::string seed() const;
|
||||||
std::string getSeedLanguage() const;
|
std::string getSeedLanguage() const;
|
||||||
void setSeedLanguage(const std::string &arg);
|
void setSeedLanguage(const std::string &arg);
|
||||||
|
|
|
@ -102,10 +102,10 @@ Wallet *WalletManagerImpl::createWalletFromKeys(const std::string &path,
|
||||||
return wallet;
|
return wallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletManagerImpl::closeWallet(Wallet *wallet)
|
bool WalletManagerImpl::closeWallet(Wallet *wallet, bool store)
|
||||||
{
|
{
|
||||||
WalletImpl * wallet_ = dynamic_cast<WalletImpl*>(wallet);
|
WalletImpl * wallet_ = dynamic_cast<WalletImpl*>(wallet);
|
||||||
bool result = wallet_->close();
|
bool result = wallet_->close(store);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
m_errorString = wallet_->errorString();
|
m_errorString = wallet_->errorString();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
const std::string &addressString,
|
const std::string &addressString,
|
||||||
const std::string &viewKeyString,
|
const std::string &viewKeyString,
|
||||||
const std::string &spendKeyString = "");
|
const std::string &spendKeyString = "");
|
||||||
virtual bool closeWallet(Wallet *wallet);
|
virtual bool closeWallet(Wallet *wallet, bool store = true);
|
||||||
bool walletExists(const std::string &path);
|
bool walletExists(const std::string &path);
|
||||||
bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool watch_only) const;
|
bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool watch_only) const;
|
||||||
std::vector<std::string> findWallets(const std::string &path);
|
std::vector<std::string> findWallets(const std::string &path);
|
||||||
|
|
|
@ -663,7 +663,7 @@ struct WalletManager
|
||||||
* \param wallet previously opened / created wallet instance
|
* \param wallet previously opened / created wallet instance
|
||||||
* \return None
|
* \return None
|
||||||
*/
|
*/
|
||||||
virtual bool closeWallet(Wallet *wallet) = 0;
|
virtual bool closeWallet(Wallet *wallet, bool store = true) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ! checks if wallet with the given name already exists
|
* ! checks if wallet with the given name already exists
|
||||||
|
|
Loading…
Reference in New Issue