diff --git a/src/monero_wallet_wrapper/MoneroWallet.cc b/src/monero_wallet_wrapper/MoneroWallet.cc index 440126758..a5516f4ae 100644 --- a/src/monero_wallet_wrapper/MoneroWallet.cc +++ b/src/monero_wallet_wrapper/MoneroWallet.cc @@ -208,7 +208,7 @@ const std::multimap Wallet::getAllPayments() bool Wallet::refresh() { - std::lock_guard lLockRefresh(refresh_mutex); + refresh_mutex.lock(); size_t lFetchedBlocks; bool lHasReceivedMoney; @@ -216,6 +216,12 @@ bool Wallet::refresh() { wallet_impl->refresh(lFetchedBlocks, lHasReceivedMoney, lIsOk); + refresh_mutex.unlock(); + + if (lIsOk && observer) { + observer->on_wallet_refreshed(this, lFetchedBlocks, lHasReceivedMoney); + } + return lIsOk; } diff --git a/src/monero_wallet_wrapper/MoneroWalletObserver.hh b/src/monero_wallet_wrapper/MoneroWalletObserver.hh index eaa1cf2a7..215729a50 100644 --- a/src/monero_wallet_wrapper/MoneroWalletObserver.hh +++ b/src/monero_wallet_wrapper/MoneroWalletObserver.hh @@ -18,6 +18,9 @@ public: 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_wallet_refreshed(Monero::Wallet* wallet, size_t fetched_blocks_count, bool hasReceivedMoney) = 0; + }; } \ No newline at end of file