feat(fullnode): show Sapling note witness-rebuild progress

The daemon's post-rescan witness rebuild ("Building Witnesses for block ...")
is a distinct, often-long phase that previously showed only as an indeterminate
"Rescanning..." with no progress. Parse the daemon's witness-build log lines and
surface a dedicated progress indicator.

- Parse "Building Witnesses for block <h> <frac> complete, <n> remaining" (and the
  earlier "Setting Initial Sapling Witness for tx ..., <i> of <m>") from daemon
  output, extracting a 0..1 fraction and remaining-block count.
- New SyncInfo fields building_witnesses / witness_progress / witness_remaining,
  cleared at every rescan-completion site (warmup-end, getrescaninfo poll, runtime
  rescan callback, daemon-log "finished").
- Status bar shows "Rebuilding witnesses NN%" (priority over the generic rescan
  text); the loading overlay (shown during -rescan warmup) gets a labelled witness
  progress bar with the remaining-block count.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-21 12:23:52 -05:00
parent a0532275dd
commit b32fe07cb1
4 changed files with 143 additions and 4 deletions

View File

@@ -126,7 +126,14 @@ struct SyncInfo {
bool rescanning = false;
float rescan_progress = 0.0f; // 0.0 - 1.0
std::string rescan_status; // e.g. "Rescanning... 25%"
// Sapling note witness rebuild (the phase after a rescan/zap where the daemon rebuilds the
// wallet's note witnesses, logged as "Building Witnesses for block ..."). Tracked separately
// from rescan_progress because it's a distinct, often-long phase with its own progress.
bool building_witnesses = false;
float witness_progress = 0.0f; // 0.0 - 1.0
int witness_remaining = 0; // blocks left to build witnesses for (0 if unknown)
bool isSynced() const { return !syncing && blocks > 0 && blocks >= headers - 2; }
};