diff options
author | Jaquee <jaquee.monero@gmail.com> | 2017-08-05 00:08:32 +0200 |
---|---|---|
committer | Jaquee <jaquee.monero@gmail.com> | 2017-10-15 17:57:45 +0200 |
commit | 9442b0430274fa34d0bfe02865968a57bcca1281 (patch) | |
tree | 6d29557826350873fa16c4a165aa056f307e42ef /src/wallet/api/wallet.cpp | |
parent | walletAPI: add lightwallet login() and importWalletRequest() (diff) | |
download | monero-9442b0430274fa34d0bfe02865968a57bcca1281.tar.xz |
walletAPI: lightwallet exceptions
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r-- | src/wallet/api/wallet.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 5e6972a92..1eba791cf 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -766,6 +766,9 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const uint64_t WalletImpl::blockChainHeight() const { + if(m_wallet->light_wallet()) { + return m_wallet->get_light_wallet_scanned_block_height(); + } return m_wallet->get_blockchain_current_height(); } uint64_t WalletImpl::approximateBlockChainHeight() const @@ -774,6 +777,9 @@ uint64_t WalletImpl::approximateBlockChainHeight() const } uint64_t WalletImpl::daemonBlockChainHeight() const { + if(m_wallet->light_wallet()) { + return m_wallet->get_light_wallet_scanned_block_height(); + } if (!m_is_connected) return 0; std::string err; @@ -793,6 +799,9 @@ uint64_t WalletImpl::daemonBlockChainHeight() const uint64_t WalletImpl::daemonBlockChainTargetHeight() const { + if(m_wallet->light_wallet()) { + return m_wallet->get_light_wallet_blockchain_height(); + } if (!m_is_connected) return 0; std::string err; @@ -1381,7 +1390,8 @@ Wallet::ConnectionStatus WalletImpl::connected() const m_is_connected = m_wallet->check_connection(&version, DEFAULT_CONNECTION_TIMEOUT_MILLIS); if (!m_is_connected) return Wallet::ConnectionStatus_Disconnected; - if ((version >> 16) != CORE_RPC_VERSION_MAJOR) + // Version check is not implemented in light wallets nodes/wallets + if (!m_wallet->light_wallet() && (version >> 16) != CORE_RPC_VERSION_MAJOR) return Wallet::ConnectionStatus_WrongVersion; return Wallet::ConnectionStatus_Connected; } @@ -1444,7 +1454,7 @@ void WalletImpl::doRefresh() try { // Syncing daemon and refreshing wallet simultaneously is very resource intensive. // Disable refresh if wallet is disconnected or daemon isn't synced. - if (daemonSynced()) { + if (m_wallet->light_wallet() || daemonSynced()) { m_wallet->refresh(); if (!m_synchronized) { m_synchronized = true; |