Added 'on_wallet_refreshed' observer callback

This commit is contained in:
Neozaru 2014-06-20 22:49:03 +02:00
parent 878db6791c
commit 06bddbc7d5
2 changed files with 10 additions and 1 deletions

View File

@ -208,7 +208,7 @@ const std::multimap<std::string,Payment> Wallet::getAllPayments()
bool Wallet::refresh() { bool Wallet::refresh() {
std::lock_guard<std::mutex> lLockRefresh(refresh_mutex); refresh_mutex.lock();
size_t lFetchedBlocks; size_t lFetchedBlocks;
bool lHasReceivedMoney; bool lHasReceivedMoney;
@ -216,6 +216,12 @@ bool Wallet::refresh() {
wallet_impl->refresh(lFetchedBlocks, lHasReceivedMoney, lIsOk); wallet_impl->refresh(lFetchedBlocks, lHasReceivedMoney, lIsOk);
refresh_mutex.unlock();
if (lIsOk && observer) {
observer->on_wallet_refreshed(this, lFetchedBlocks, lHasReceivedMoney);
}
return lIsOk; return lIsOk;
} }

View File

@ -18,6 +18,9 @@ public:
virtual void on_skip_transaction(uint64_t height, const std::string& transaction_id) = 0; virtual void on_skip_transaction(uint64_t height, const std::string& transaction_id) = 0;
virtual void on_payment_received(uint64_t height, const std::string& payment_id, const Payment& payment) = 0; virtual void on_payment_received(uint64_t height, const std::string& payment_id, const Payment& payment) = 0;
virtual void on_wallet_refreshed(Monero::Wallet* wallet, size_t fetched_blocks_count, bool hasReceivedMoney) = 0;
}; };
} }