aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-08-05 01:53:16 +0200
committerJaquee <jaquee.monero@gmail.com>2017-10-15 17:58:28 +0200
commitd92618675b50c48b70395a94c92325e3c8fa2efd (patch)
tree9249f0984d58acf6d576f51837378c6e6784aeb3
parentwalletAPI: lightwallet exceptions (diff)
downloadmonero-d92618675b50c48b70395a94c92325e3c8fa2efd.tar.xz
walletAPI: correct confirmations in txHistory for unsynced wallets
-rw-r--r--src/wallet/api/transaction_history.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/api/transaction_history.cpp b/src/wallet/api/transaction_history.cpp
index 9f7b491f4..59eca3dd7 100644
--- a/src/wallet/api/transaction_history.cpp
+++ b/src/wallet/api/transaction_history.cpp
@@ -134,7 +134,7 @@ void TransactionHistoryImpl::refresh()
ti->m_subaddrAccount = pd.m_subaddr_index.major;
ti->m_label = m_wallet->m_wallet->get_subaddress_label(pd.m_subaddr_index);
ti->m_timestamp = pd.m_timestamp;
- ti->m_confirmations = wallet_height - pd.m_block_height;
+ ti->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
ti->m_unlock_time = pd.m_unlock_time;
m_history.push_back(ti);
@@ -177,7 +177,7 @@ void TransactionHistoryImpl::refresh()
ti->m_subaddrAccount = pd.m_subaddr_account;
ti->m_label = pd.m_subaddr_indices.size() == 1 ? m_wallet->m_wallet->get_subaddress_label({pd.m_subaddr_account, *pd.m_subaddr_indices.begin()}) : "";
ti->m_timestamp = pd.m_timestamp;
- ti->m_confirmations = wallet_height - pd.m_block_height;
+ ti->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
// single output transaction might contain multiple transfers
for (const auto &d: pd.m_dests) {