fix(history): let the shielded scan complete + unstick send-progress on many-z-addr wallets
Two issues shared one root cause: the shielded-receive scan marked each z-address "scanned at the EXACT current tip," but a new block (~36s on DRGX) advances the tip and invalidates every prior per-address scan. A wallet with more z-addresses than one refresh cycle can scan therefore never reached "all scanned at tip" — so shieldedScanComplete stayed false and transactions_dirty_ stayed true forever, which (a) kept the history-refresh banner lit and the full rescan churning every cycle, and (b) blocked maybeFinishTransactionSendProgress (it waited on transactions_dirty_), leaving the send-progress indicator stuck on. Fix 1 — completion tolerance. Add TransactionRefreshSnapshot::shieldedScanTipTolerance: an address counts as fresh if its last scan is within N blocks of the tip (0 = old strict behavior, so existing tests are unchanged). The app scales N with the z-address count (2 + count/96, capped at 50), so a multi-block pass can COMPLETE before its earliest scan goes stale. This also throttles full rescans to ~N blocks instead of every block — transactions_dirty_ clears, the banner stops, and CPU/RPC churn drops. Already-fresh addresses are skipped, so the per-block cost falls back to just the (cheap) transparent listtransactions. Fix 2 — send-progress gate. maybeFinishTransactionSendProgress() no longer waits on the transaction history scan (transactions_dirty_ / Transactions job): the sent tx is already shown via the optimistic pending insert, and the spend is reflected once the balance refresh lands, so it now finishes on the address/balance signal alone. Test: a tolerant snapshot skips recently-scanned addresses (shieldedAddressesScanned == 0, shieldedScanComplete) while a strict one re-scans them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3664,9 +3664,11 @@ void App::maybeFinishTransactionSendProgress()
|
||||
using Job = services::NetworkRefreshService::Job;
|
||||
if (!send_progress_active_) return;
|
||||
if (send_submissions_in_flight_ > 0 || !pending_opids_.empty()) return;
|
||||
if (addresses_dirty_ || transactions_dirty_) return;
|
||||
if (network_refresh_.jobInProgress(Job::Addresses) ||
|
||||
network_refresh_.jobInProgress(Job::Transactions)) return;
|
||||
// Finish once the spend is reflected in the balance (addresses). Do NOT wait on the transaction
|
||||
// history scan: the sent tx is already shown via the optimistic pending insert, and the shielded
|
||||
// history scan can stay "dirty" for a long time on wallets with many z-addresses — gating on it
|
||||
// left the send-progress indicator stuck on indefinitely.
|
||||
if (addresses_dirty_ || network_refresh_.jobInProgress(Job::Addresses)) return;
|
||||
send_progress_active_ = false;
|
||||
}
|
||||
void App::restartDaemon()
|
||||
|
||||
Reference in New Issue
Block a user