fix(ui): show real data and consistent values across tabs

- Market chart now plots the real accumulated price_history instead of a
  rand()-generated curve; the hover tooltip no longer claims a specific "Xh ago"
  price and the x-axis only labels the truthful "Now" point. Falls back to the
  existing empty state until there are >=2 real samples.
- Transactions summary cards exclude autoshield legs (same txid send + receive-to-z)
  so a shield isn't double-counted into both Sent and Received, matching the list.
- Send/Receive sync banners use verification_progress like every other surface,
  instead of the blocks/headers ratio that over-reports during early sync.
- Fix printf format/type mismatches: %.0f<-int (market % shielded), %d<-size_t
  (peer counts), %ld<-int64_t (peer byte counters, wrong on Windows).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 14:17:42 -05:00
parent 53a10e149d
commit 3799330bb0
5 changed files with 62 additions and 39 deletions

View File

@@ -507,8 +507,10 @@ void RenderPeersTab(App* app)
float toggleY = ImGui::GetCursorScreenPos().y;
{
char connLabel[64], banLabel[64];
snprintf(connLabel, sizeof(connLabel), TR("peers_connected_count"), state.peers.size());
snprintf(banLabel, sizeof(banLabel), TR("peers_banned_count"), state.bannedPeers.size());
// Format strings use %d — cast size_t down to int (a 64-bit size_t passed to %d
// is a format/type mismatch / UB; peer counts comfortably fit in int).
snprintf(connLabel, sizeof(connLabel), TR("peers_connected_count"), (int)state.peers.size());
snprintf(banLabel, sizeof(banLabel), TR("peers_banned_count"), (int)state.bannedPeers.size());
ImVec2 connSz = body2->CalcTextSizeA(body2->LegacySize, FLT_MAX, 0, connLabel);
ImVec2 banSz = body2->CalcTextSizeA(body2->LegacySize, FLT_MAX, 0, banLabel);
@@ -822,9 +824,10 @@ void RenderPeersTab(App* app)
TTRow(TR("peers_tt_services"), peer.services.c_str());
snprintf(ttBuf, sizeof(ttBuf), "%d", peer.startingheight);
TTRow(TR("peers_tt_start_height"), ttBuf);
snprintf(ttBuf, sizeof(ttBuf), "%ld bytes", peer.bytessent);
// %lld + (long long) — %ld truncates int64_t on Windows (LLP64).
snprintf(ttBuf, sizeof(ttBuf), "%lld bytes", (long long)peer.bytessent);
TTRow(TR("peers_tt_sent"), ttBuf);
snprintf(ttBuf, sizeof(ttBuf), "%ld bytes", peer.bytesrecv);
snprintf(ttBuf, sizeof(ttBuf), "%lld bytes", (long long)peer.bytesrecv);
TTRow(TR("peers_tt_received"), ttBuf);
snprintf(ttBuf, sizeof(ttBuf), "%d / %d", peer.synced_headers, peer.synced_blocks);
TTRow(TR("peers_tt_synced"), ttBuf);