diff --git a/src/app.cpp b/src/app.cpp index 1e54a6b..7e12b0a 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -2163,10 +2163,10 @@ void App::render() // long confirmed (the other leg holds the real count). So: a txid with ANY confirmed leg is // confirmed, and we count UNIQUE unconfirmed txids — otherwise the badge sticks on stale 0-conf // legs of already-confirmed transactions and double-counts multi-leg ones. - // Recompute only when the tx list actually changed (last_tx_update is bumped on every tx refresh; - // size() catches same-second content changes). Otherwise this built two unordered_sets over the whole + // Recompute only when the tx list actually changed. tx_revision moves on EVERY content change (incl. a + // confirmation flip at equal tx count) and, unlike last_tx_update, lite stamps it. Otherwise this built two unordered_sets over the whole // wallet tx list every frame just to size a badge. - if (state_.last_tx_update != sb_unconf_key_ts_ || state_.transactions.size() != sb_unconf_key_n_) { + if (state_.tx_revision != sb_unconf_key_rev_) { std::unordered_set confirmedTxids; for (const auto& tx : state_.transactions) { if (tx.confirmations >= 1) confirmedTxids.insert(tx.txid); @@ -2178,8 +2178,7 @@ void App::render() } } sb_unconf_count_ = static_cast(unconfirmedTxids.size()); - sb_unconf_key_ts_ = state_.last_tx_update; - sb_unconf_key_n_ = state_.transactions.size(); + sb_unconf_key_rev_ = state_.tx_revision; } sbStatus.unconfirmedTxCount = sb_unconf_count_; diff --git a/src/app.h b/src/app.h index eecd018..fe37fab 100644 --- a/src/app.h +++ b/src/app.h @@ -1006,10 +1006,9 @@ private: mutable std::uint64_t chat_unread_rev_ = ~0ull; // ~0 forces the first compute mutable int chat_unread_cached_ = 0; mutable double chat_unread_computed_at_ = 0.0; - // Sidebar unconfirmed-tx badge — recomputed only when the tx list changes (keyed on last_tx_update + - // size), not every frame. See App::render(). - std::int64_t sb_unconf_key_ts_ = -1; - std::size_t sb_unconf_key_n_ = 0; + // Sidebar unconfirmed-tx badge — recomputed only when the tx list changes (keyed on tx_revision), + // not every frame. See App::render(). + std::uint64_t sb_unconf_key_rev_ = 0; // sentinel 0 never matches: tx_revision starts at 1 int sb_unconf_count_ = 0; // Daemon-memory probe is expensive (/proc scan on Linux, popen on macOS): it runs on this sampler's own // thread, at most once per 3 s and only while a reader asks (Mining tab memory bar, Peers tab Memory cell).