From 9c40039fda1316a86ca510f70ac0f14c3e01e2ca Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 4 Jun 2026 16:37:59 +0100 Subject: [PATCH] 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 --- src/xrpld/app/ledger/LedgerHistory.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/xrpld/app/ledger/LedgerHistory.cpp b/src/xrpld/app/ledger/LedgerHistory.cpp index 77c542fb16..092e88e28a 100644 --- a/src/xrpld/app/ledger/LedgerHistory.cpp +++ b/src/xrpld/app/ledger/LedgerHistory.cpp @@ -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