aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-06-26 14:45:20 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-06-26 14:45:28 -0400
commit49464004701e5ac256fe1f3e969464012af7c598 (patch)
tree5bb1798ddee41458a657130d86cf030fabb0ca86 /src/qt/walletmodel.cpp
parent3bbd8225b92dbfe48e402875bee265995b3f2383 (diff)
parentd906aaa117e337fc70575beecc0d6da314f57385 (diff)
downloadbitcoin-49464004701e5ac256fe1f3e969464012af7c598.tar.xz
Merge bitcoin-core/gui#8: Fix regression in TransactionTableModel
d906aaa117e337fc70575beecc0d6da314f57385 qt: Fix regression in TransactionTableModel (Hennadii Stepanov) Pull request description: Since https://github.com/bitcoin/bitcoin/pull/17993 a crash is possible on exit. Steps to reproduce: - precondition: the old chain - start `bitcoin-qt` - wait until sync - on main window: Menu -> File -> Quit - crash This PR is based on ryanofsky's [suggestion](https://github.com/bitcoin-core/gui/issues/7#issuecomment-646639251). Fixes #7. ACKs for top commit: promag: Code review ACK d906aaa117e337fc70575beecc0d6da314f57385. ryanofsky: Code review ACK d906aaa117e337fc70575beecc0d6da314f57385. Only changes are squashing, adding assert and adding const vasild: ACK d906aaa1 Tree-SHA512: 99a475fd90dff50407a58537fdc6099a2a074018e9078452bf86defc1a4b9e546aa94f916d242355900b21638c6cfef845598a5282661a9343556c4514eb155f
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r--src/qt/walletmodel.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 72c75f7be0..1143969352 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -87,7 +87,7 @@ void WalletModel::pollBalanceChanged()
{
// Avoid recomputing wallet balances unless a TransactionChanged or
// BlockTip notification was received.
- if (!fForceCheckBalanceChanged && m_cached_last_update_tip == m_client_model->getBestBlockHash()) return;
+ if (!fForceCheckBalanceChanged && m_cached_last_update_tip == getLastBlockProcessed()) return;
// Try to get balances and return early if locks can't be acquired. This
// avoids the GUI from getting stuck on periodical polls if the core is
@@ -588,3 +588,8 @@ void WalletModel::refresh(bool pk_hash_only)
{
addressTableModel = new AddressTableModel(this, pk_hash_only);
}
+
+uint256 WalletModel::getLastBlockProcessed() const
+{
+ return m_client_model ? m_client_model->getBestBlockHash() : uint256{};
+}