From 555f541c84add2c0b2c4387aadf47027916612e4 Mon Sep 17 00:00:00 2001 From: DanS Date: Sat, 13 Jun 2026 09:13:36 -0500 Subject: [PATCH] fix(history): update tx labels immediately when a mining address is toggled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unmarking (or marking) a mining address didn't change the history. The refresh re-scanned the affected transaction as "receive", but appendMissingPreviousTransactions carries over not-yet-rescanned prior transactions and dedupes by txid+TYPE — so the stale "mined" copy was carried over right alongside the fresh "receive", and the change never appeared. Re-label state_.transactions in setMiningAddress() the moment the flag changes (mined vs receive is just whether the receiving address is mining-flagged). The History tab updates instantly, and the next refresh's carry-over now matches the fresh scan instead of duplicating the old label. The reclassified list is also persisted via the existing cache save. Co-Authored-By: Claude Opus 4.8 --- src/app_network.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app_network.cpp b/src/app_network.cpp index a7689dc..6a8e408 100644 --- a/src/app_network.cpp +++ b/src/app_network.cpp @@ -2070,6 +2070,20 @@ void App::setMiningAddress(const std::string& addr, bool mining) if (settings_) { settings_->setMiningAddress(addr, mining); settings_->save(); + + // Re-label the in-memory history right away. "mined" vs "receive" is purely a function of + // whether the receiving address is flagged for mining, so flip the affected rows now: the + // History tab updates immediately, and — importantly — the next refresh's carry-over of + // not-yet-rescanned transactions then matches the fresh scan. (Without this, the refresh + // re-scans a tx as "receive" but appendMissingPreviousTransactions, which dedupes by + // txid+type, still carries the stale "mined" copy over, so the change never showed.) + const auto miningAddrs = settings_->getMiningAddresses(); + for (auto& tx : state_.transactions) { + if ((tx.type == "receive" || tx.type == "mined") && !tx.address.empty()) { + tx.type = miningAddrs.count(tx.address) ? "mined" : "receive"; + } + } + invalidateShieldedHistoryScanProgress(true); transactions_dirty_ = true; last_tx_block_height_ = -1;