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:
@@ -164,7 +164,30 @@ void RenderTransactionsTab(App* app)
|
||||
int recvCount = 0, sendCount = 0, minedCount = 0;
|
||||
double recvTotal = 0.0, sendTotal = 0.0, minedTotal = 0.0;
|
||||
|
||||
for (const auto& tx : state.transactions) {
|
||||
// Identify autoshield legs (same txid with a "send" leg and a "receive"-to-z leg):
|
||||
// that pair is a single internal shielding move — shown as one "Shield" row in the
|
||||
// list below — not income or spending. Counting both legs double-counts the amount
|
||||
// into BOTH the Sent and Received totals, so the cards disagree with the list.
|
||||
// Mirror the list's pairing logic and exclude both legs from the totals.
|
||||
std::unordered_map<std::string, std::vector<size_t>> summaryTxidMap;
|
||||
for (size_t i = 0; i < state.transactions.size(); i++)
|
||||
summaryTxidMap[state.transactions[i].txid].push_back(i);
|
||||
std::vector<bool> isShieldLeg(state.transactions.size(), false);
|
||||
for (const auto& kv : summaryTxidMap) {
|
||||
if (kv.second.size() < 2) continue;
|
||||
int send_i = -1, recv_i = -1;
|
||||
for (size_t si : kv.second) {
|
||||
const auto& stx = state.transactions[si];
|
||||
if (stx.type == "send" && send_i < 0) send_i = (int)si;
|
||||
else if (stx.type == "receive" && recv_i < 0 &&
|
||||
!stx.address.empty() && stx.address[0] == 'z') recv_i = (int)si;
|
||||
}
|
||||
if (send_i >= 0 && recv_i >= 0) { isShieldLeg[send_i] = true; isShieldLeg[recv_i] = true; }
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < state.transactions.size(); i++) {
|
||||
if (isShieldLeg[i]) continue; // internal shielding move — not received or sent
|
||||
const auto& tx = state.transactions[i];
|
||||
if (tx.type == "receive") {
|
||||
recvCount++;
|
||||
recvTotal += std::abs(tx.amount);
|
||||
|
||||
Reference in New Issue
Block a user