aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-09-30 22:42:15 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-09-30 22:42:15 +0300
commit10fe626e13297d9712763a51174cd6437185e53d (patch)
tree7e5519eb9a12f423eb3e33ce328c1dc0d272dd90 /src/wallet/api
parentlibwallet_api: fix unhandled exception on address check (diff)
downloadmonero-10fe626e13297d9712763a51174cd6437185e53d.tar.xz
libwallet_api: fast-refresh in case of opening non-synced wallet
Diffstat (limited to 'src/wallet/api')
-rw-r--r--src/wallet/api/wallet.cpp9
-rw-r--r--src/wallet/api/wallet.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 55b13ba7e..9bb7f0569 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -175,7 +175,7 @@ WalletImpl::WalletImpl(bool testnet)
m_wallet->callback(m_wallet2Callback);
m_refreshThreadDone = false;
m_refreshEnabled = false;
- m_newWallet = true;
+
m_refreshIntervalMillis = DEFAULT_REFRESH_INTERVAL_MILLIS;
@@ -196,7 +196,6 @@ WalletImpl::~WalletImpl()
bool WalletImpl::create(const std::string &path, const std::string &password, const std::string &language)
{
- m_newWallet = true;
clearStatus();
bool keys_file_exists;
@@ -234,7 +233,6 @@ bool WalletImpl::create(const std::string &path, const std::string &password, co
bool WalletImpl::open(const std::string &path, const std::string &password)
{
- m_newWallet = false;
clearStatus();
try {
// TODO: handle "deprecated"
@@ -746,7 +744,10 @@ void WalletImpl::pauseRefresh()
bool WalletImpl::isNewWallet() const
{
- return m_newWallet;
+ // in case wallet created without daemon connection, closed and opened again,
+ // it's the same case as if it created from scratch, i.e. we need "fast sync"
+ // with the daemon (pull hashes instead of pull blocks)
+ return !(blockChainHeight() > 1);
}
void WalletImpl::doInit(const string &daemon_address, uint64_t upper_transaction_size_limit)
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index e2eb05167..09db05d08 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -128,8 +128,6 @@ private:
boost::mutex m_refreshMutex2;
boost::condition_variable m_refreshCV;
boost::thread m_refreshThread;
- bool m_newWallet;
-
};