Skip to content

Commit 321335b

Browse files
committed
GUI: add getter for WalletModel::m_cached_balances field
No need to guard it as it is/will only be accessed from the main thread for now
1 parent e62958d commit 321335b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/qt/walletmodel.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,17 @@ void WalletModel::pollBalanceChanged()
120120

121121
void WalletModel::checkBalanceChanged(const interfaces::WalletBalances& new_balances)
122122
{
123-
if(new_balances.balanceChanged(m_cached_balances)) {
123+
if (new_balances.balanceChanged(m_cached_balances)) {
124124
m_cached_balances = new_balances;
125125
Q_EMIT balanceChanged(new_balances);
126126
}
127127
}
128128

129+
interfaces::WalletBalances WalletModel::getCachedBalance() const
130+
{
131+
return m_cached_balances;
132+
}
133+
129134
void WalletModel::updateTransaction()
130135
{
131136
// Balance and number of transactions might have changed

src/qt/walletmodel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ class WalletModel : public QObject
157157

158158
uint256 getLastBlockProcessed() const;
159159

160+
// Retrieve the cached wallet balance
161+
interfaces::WalletBalances getCachedBalance() const;
162+
160163
private:
161164
std::unique_ptr<interfaces::Wallet> m_wallet;
162165
std::unique_ptr<interfaces::Handler> m_handler_unload;

0 commit comments

Comments
 (0)