aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-01-30 18:00:10 +0100
committerJaquee <jaquee.monero@gmail.com>2017-02-04 23:25:05 +0100
commit0cc50bdd11a9d66f769a6e0d03d72fd4f6b33bff (patch)
tree476bfda83f431bbc63f427b776ade0fdc401e27c /src/wallet
parentwallet api: Remove initAsync() and don't start refresh automatically on init (diff)
downloadmonero-0cc50bdd11a9d66f769a6e0d03d72fd4f6b33bff.tar.xz
GUI: Improved refresh performance
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/api/wallet.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index deab4fe1f..830f98909 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -85,11 +85,14 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
virtual void on_new_block(uint64_t height, const cryptonote::block& block)
{
- //LOG_PRINT_L3(__FUNCTION__ << ": new block. height: " << height);
-
- if (m_listener) {
- m_listener->newBlock(height);
- // m_listener->updated();
+ // Don't flood the GUI with signals. On fast refresh - send signal every 1000th block
+ // get_refresh_from_block_height() returns the blockheight from when the wallet was
+ // created or the restore height specified when wallet was recovered
+ if(height >= m_wallet->m_wallet->get_refresh_from_block_height() || height % 1000 == 0) {
+ // LOG_PRINT_L3(__FUNCTION__ << ": new block. height: " << height);
+ if (m_listener) {
+ m_listener->newBlock(height);
+ }
}
}
@@ -534,7 +537,7 @@ bool WalletImpl::close()
if (status() != Status_Critical)
m_wallet->store();
else
- LOG_PRINT_L3("Status_Critical - not storing wallet");
+ LOG_ERROR("Status_Critical - not storing wallet");
LOG_PRINT_L1("wallet::store done");
LOG_PRINT_L1("Calling wallet::stop...");
m_wallet->stop();
@@ -1310,8 +1313,8 @@ void WalletImpl::doRefresh()
void WalletImpl::startRefresh()
{
- LOG_PRINT_L2(__FUNCTION__ << ": refresh started/resumed...");
if (!m_refreshEnabled) {
+ LOG_PRINT_L2(__FUNCTION__ << ": refresh started/resumed...");
m_refreshEnabled = true;
m_refreshCV.notify_one();
}