| 111 | } |
| 112 | |
| 113 | void WalletModel::pollBalanceChanged() |
| 114 | { |
| 115 | // Avoid recomputing wallet balances unless a TransactionChanged or |
| 116 | // BlockTip notification was received. |
| 117 | if (!fForceCheckBalanceChanged && m_cached_last_update_tip == getLastBlockProcessed()) return; |
| 118 | |
| 119 | // Try to get balances and return early if locks can't be acquired. This |
| 120 | // avoids the GUI from getting stuck on periodical polls if the core is |
| 121 | // holding the locks for a longer time - for example, during a wallet |
| 122 | // rescan. |
| 123 | interfaces::WalletBalances new_balances; |
| 124 | uint256 block_hash; |
| 125 | if (!m_wallet->tryGetBalances(new_balances, block_hash)) { |
| 126 | return; |
| 127 | } |
| 128 | |
| 129 | if (fForceCheckBalanceChanged || block_hash != m_cached_last_update_tip) { |
| 130 | fForceCheckBalanceChanged = false; |
| 131 | |
| 132 | // Balance and number of transactions might have changed |
| 133 | m_cached_last_update_tip = block_hash; |
| 134 | |
| 135 | checkBalanceChanged(new_balances); |
| 136 | if(transactionTableModel) |
| 137 | transactionTableModel->updateConfirmations(); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | void WalletModel::checkBalanceChanged(const interfaces::WalletBalances& new_balances) |
| 142 | { |
nothing calls this directly
no test coverage detected