aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-09-23 22:36:37 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-09-26 23:19:25 +0300
commit9de3ec3e2a48a4695b77c66add93c2fbf42affc2 (patch)
treed085ad133c6cf2568a29d3399674889402ada6ce /src/wallet/api
parentMerge pull request #1117 (diff)
downloadmonero-9de3ec3e2a48a4695b77c66add93c2fbf42affc2.tar.xz
libwallet_api: Wallet::blockChainHeight, WalletListener::newBlock
Diffstat (limited to 'src/wallet/api')
-rw-r--r--src/wallet/api/wallet.cpp10
-rw-r--r--src/wallet/api/wallet.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 49ccceb13..eef956e80 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -75,8 +75,12 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
virtual void on_new_block(uint64_t height, const cryptonote::block& block)
{
- // TODO;
LOG_PRINT_L3(__FUNCTION__ << ": new block. height: " << height);
+
+ if (m_listener) {
+ m_listener->newBlock(height);
+ m_listener->updated();
+ }
}
virtual void on_money_received(uint64_t height, const cryptonote::transaction& tx, uint64_t amount)
@@ -413,6 +417,10 @@ uint64_t WalletImpl::unlockedBalance() const
return m_wallet->unlocked_balance();
}
+uint64_t WalletImpl::blockChainHeight() const
+{
+ return m_wallet->get_blockchain_current_height();
+}
bool WalletImpl::refresh()
{
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index 11880d555..1a34a04fd 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -75,6 +75,7 @@ public:
bool trustedDaemon() const;
uint64_t balance() const;
uint64_t unlockedBalance() const;
+ uint64_t blockChainHeight() const;
bool refresh();
void refreshAsync();
void setAutoRefreshInterval(int seconds);