MCPcopy Create free account
hub / github.com/ElementsProject/elements / pollBalanceChanged

Method pollBalanceChanged

src/qt/walletmodel.cpp:113–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void 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
141void WalletModel::checkBalanceChanged(const interfaces::WalletBalances& new_balances)
142{

Callers

nothing calls this directly

Calls 2

tryGetBalancesMethod · 0.80
updateConfirmationsMethod · 0.80

Tested by

no test coverage detected