Skip to content

Commit d9b619f

Browse files
committed
src/qt/mempooltxtables.cpp:displaying tx_table and stats indicators
1 parent a9b56df commit d9b619f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/qt/mempoolstats.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,16 +430,19 @@ void MempoolStats::onWalletTxChanged()
430430
{
431431
{
432432
QMutexLocker locker(&m_wallet_tx_mutex);
433-
m_wallet_transactions.clear();
434433
if (m_clientmodel) {
434+
m_clientmodel->m_wallet_transactions.clear(); // Clear ClientModel's transactions
435435
for (std::unique_ptr<interfaces::Wallet>& wallet_ptr : m_clientmodel->node().walletLoader().getWallets()) {
436436
if (!wallet_ptr) continue;
437437
for (const interfaces::WalletTx& wtx : wallet_ptr->getWalletTxs()) {
438-
m_wallet_transactions.insert(wtx);
438+
m_clientmodel->m_wallet_transactions.insert(wtx); // Populate ClientModel's transactions
439439
}
440440
}
441+
m_wallet_transactions = m_clientmodel->m_wallet_transactions; // Keep MempoolStats's local copy in sync for indicators
441442
}
442443
}
443444
QMetaObject::invokeMethod(this, "drawChart", Qt::QueuedConnection);
444-
Q_EMIT walletTxChanged();
445+
if (m_clientmodel) {
446+
Q_EMIT m_clientmodel->walletTxChanged(); // Emit ClientModel's signal
447+
}
445448
}

src/qt/mempooltxtables.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ void MempoolTxTableModel::updateModel(const std::set<interfaces::WalletTx>& wall
112112
{
113113
beginResetModel();
114114
m_tx_data.clear();
115+
116+
if (wallet_transactions.empty()) {
117+
endResetModel();
118+
return;
119+
}
120+
115121
for (const auto& wtx : wallet_transactions) {
116122
// Only add transactions that are currently in the mempool
117123
// This logic might need to be more sophisticated if we want to show other statuses

0 commit comments

Comments
 (0)