aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-08-04 23:00:25 +0200
committerJaquee <jaquee.monero@gmail.com>2017-10-15 17:48:41 +0200
commit32e2b0030ec451968aa943adac9211fc4f8d9f87 (patch)
tree2d2ee3feac72b6eaaae630dcf9ca529d667efd8b
parentwallet2: refresh() lightwallet support (diff)
downloadmonero-32e2b0030ec451968aa943adac9211fc4f8d9f87.tar.xz
wallet2: add lightwallet exceptions to common functions
-rw-r--r--src/wallet/wallet2.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 7c2d1b115..263042a24 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2648,6 +2648,12 @@ bool wallet2::check_connection(uint32_t *version, uint32_t timeout)
boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex);
+ // TODO: Add light wallet version check.
+ if(m_light_wallet) {
+ version = 0;
+ return m_light_wallet_connected;
+ }
+
if(!m_http_client.is_connected())
{
m_node_rpc_proxy.invalidate();
@@ -2941,6 +2947,8 @@ void wallet2::store_to(const std::string &path, const std::string &password)
uint64_t wallet2::balance(uint32_t index_major) const
{
uint64_t amount = 0;
+ if(m_light_wallet)
+ return m_light_wallet_unlocked_balance;
for (const auto& i : balance_per_subaddress(index_major))
amount += i.second;
return amount;
@@ -2949,6 +2957,8 @@ uint64_t wallet2::balance(uint32_t index_major) const
uint64_t wallet2::unlocked_balance(uint32_t index_major) const
{
uint64_t amount = 0;
+ if(m_light_wallet)
+ return m_light_wallet_balance;
for (const auto& i : unlocked_balance_per_subaddress(index_major))
amount += i.second;
return amount;
@@ -3822,6 +3832,8 @@ uint64_t wallet2::get_dynamic_per_kb_fee_estimate()
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_per_kb_fee()
{
+ if(m_light_wallet)
+ return m_light_wallet_per_kb_fee;
bool use_dyn_fee = use_fork_rules(HF_VERSION_DYNAMIC_FEE, -720 * 1);
if (!use_dyn_fee)
return FEE_PER_KB;
@@ -5733,6 +5745,9 @@ void wallet2::get_hard_fork_info(uint8_t version, uint64_t &earliest_height)
//----------------------------------------------------------------------------------------------------
bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks)
{
+ // TODO: How to get fork rule info from light wallet node?
+ if(m_light_wallet)
+ return true;
uint64_t height, earliest_height;
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
throw_on_rpc_response_error(result, "get_info");