]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
Fix: Ensure History/UI updates during background mempool scan
authorgg <chown_tee@proton.me>
Mon, 19 Jan 2026 21:55:29 +0000 (16:55 -0500)
committergg <chown_tee@proton.me>
Mon, 19 Jan 2026 21:55:29 +0000 (16:55 -0500)
src/libwalletqt/Wallet.cpp

index 192868694321103ea0c7bb150a8bfe93964c5d07..d3b00d1b5059a05923f4256b74fc7a22dbcf513e 100644 (file)
@@ -1764,14 +1764,14 @@ void Wallet::scanMempool() {
     try {
         std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
         m_wallet2->update_pool_state(process_txs, false, false);
-        if (!process_txs.empty()) {
-            m_wallet2->process_pool_state(process_txs);
-        }
-        
         // Refresh models so the UI picks up the new transaction(s)
-        if (m_history) m_history->refresh();
-        if (m_coins) m_coins->refresh();
-        if (m_subaddress) m_subaddress->refresh();
+        // We invoke this on the main thread to ensure signals (beginResetModel) are processed synchronously
+        // with the data update, preventing race conditions or ignored updates in the view.
+        QMetaObject::invokeMethod(this, [this]{
+            if (m_history) m_history->refresh();
+            if (m_coins) m_coins->refresh();
+            if (m_subaddress) m_subaddress->refresh();
+        }, Qt::QueuedConnection);
         
         emit updated();
     } catch (const std::exception &e) {