fix(telemetry): avoid double-counting consensus_txset ledger mismatches

handleMismatch() recorded the "consensus_txset" reason but then fell through
to the transaction-level comparison, which also recorded a reason
("same_txset_diff_result" / "different_txset"). A single mismatch with
disagreeing consensus tx-set hashes therefore incremented
xrpld_ledger_history_mismatch_total twice across two reason labels, so the
sum over reason exceeded the real mismatch count.

The consensus tx-set hash disagreement is the root cause; return after
recording it so each mismatch contributes exactly one reason.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-06-04 16:37:59 +01:00
parent c20d10fd36
commit 9c40039fda

View File

@@ -377,11 +377,15 @@ LedgerHistory::handleMismatch(
JLOG(j_.error()) << "MISMATCH on consensus transaction set "
<< " built: " << to_string(*builtConsensusHash)
<< " validated: " << to_string(*validatedConsensusHash);
// The consensus tx-set hashes disagree — this is the root cause,
// so record it as the single reason and stop. The tx-level
// comparison below would otherwise double-count the same mismatch.
recordReason("consensus_txset");
return;
}
else
JLOG(j_.error()) << "MISMATCH with same consensus transaction set: "
<< to_string(*builtConsensusHash);
JLOG(j_.error()) << "MISMATCH with same consensus transaction set: "
<< to_string(*builtConsensusHash);
}
// Find differences between built and valid ledgers