aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-22 23:35:48 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-22 23:43:22 +0300
commitd906aaa117e337fc70575beecc0d6da314f57385 (patch)
tree4521cc4ded39f653a8ba333db58887e6135c0fde /src/qt/walletmodel.cpp
parentdbd7a91fdf3ff801fe5e4107e8346d0d6d11a899 (diff)
downloadbitcoin-d906aaa117e337fc70575beecc0d6da314f57385.tar.xz
qt: Fix regression in TransactionTableModel
Since #17993 a crash is possible on exit. Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
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 671b5e1ce6..fde7bb29c1 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{};
+}