mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-27 15:28:03 +00:00
Three defects found in review of the two preceding commits. Drop disputes_count_initial. It claimed to be the dispute count carried in from the positions held at close, but startEstablishTracing() runs a full timer tick after closeLedger(): timerEntry() dispatches `if (phase_ == Open) phaseOpen(); else if (phase_ == Establish) phaseEstablish();`, and phase_ was Open on the closing tick, so the else-if cannot run. With ledgerGRANULARITY at 1s the value absorbed up to a second of dispute growth from peer proposals and arriving tx sets. Making it honest needs either a member captured at close or moving span creation into closeLedger(), so it is removed rather than shipped mislabelled. Record close_time_avalanche_state on recovered rounds. startRoundInternal() reset establishSpan_ inline, discarding the span before the attribute was written, so the value was present only on rounds that reached Accepted -- survivor bias in exactly the rounds worth investigating. It now calls endEstablishTracing(). The comment claiming this avoided "reporting a stale regime" was wrong: closeTimeAvalancheState_ is not reset until 39 lines later, so the value was still that span's terminal regime. Rename avalanche_state to close_time_avalanche_state. DisputedTx carries a second, per-transaction avalanche tracker; the bare name invited reading a close-time-only value as the transaction one, which is the tracker that actually escalates in a stuck round. Also: both label helpers now fall through to "unknown" instead of a plausible-looking regime, matching to_string(ConsensusPhase); and the header now records that the end-of-open attributes are absent on recovered and simulated rounds, and that tx_sets_acquired can skew either way because handleWrongLedger clears currPeerPositions_ but not acquired_. Tests: the minimum-open-time assertion used prevRoundTime=10s, where openTime=1s trips the too-fast branch as well, so deleting the ledgerMinClose check entirely left it green. Replaced with prevRoundTime=2s, which isolates the branch. Added the others-closed boundary, which is strict and was untested in either direction, its integer truncation for odd prevProposers, and its precedence over the no-transactions and minimum-open branches.