mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-28 15:58:07 +00:00
A tx-set fetch carried no key tying it to the consensus round that needed the set, so attributing a stalled fetch to a round meant guessing from timestamps. One fetch is wanted by many rounds -- it is keyed by set hash, survives the round sweep, and the round never blocks on it -- so a single parent, link or attribute cannot describe the relationship. Instead the fetch span records one timestamped event per requesting round, carrying the round's parent-ledger hash and the ledger it is building. Both attribute keys already existed in the shared telemetry namespace with exactly this meaning, and the existing addEvent API is used as-is, so no new telemetry surface is added and the whole feature compiles out with telemetry disabled. The event fires once per round rather than once per peer proposal, keyed on the round's parent-ledger hash: that distinguishes rounds started on different forks at the same height, which a ledger-height compare cannot. A mid-round wrong-ledger recovery re-enters consensus without re-caching the round identity, so a fetch begun after that switch is attributed to the pre-switch round; the limitation is documented where the values are cached. Also fixes the fetch span's end time, which depended on when the C++ object was destroyed. Three of the four exits that stop pursuing a fetch -- the set arriving from elsewhere, the round sweep, and shutdown -- ended the span only via the destructor, so the recorded duration included however long any reference happened to be held. Each exit now ends the span itself, plus cancel() and container teardown, and the destructor asserts the span is already closed rather than closing it: a fallback that can never legitimately fire should fail loudly instead of hiding a missed exit. An abandoned fetch also no longer asks peers for a set nobody wants, which previously led to charging those peers for answering our own request. Verification: pre-commit and TIDY=1 clang-tidy pass; levelization is unchanged. NOT compiled -- the branch is blocked by a gcc-15 internal compiler error in the unrelated xrpl.libxrpl.rdb unity translation unit. Runtime behaviour is unasserted: xrpl_tests links only xrpl.libxrpl, so TransactionAcquire is unreachable from GTest; the added tests cover the new span-name and attribute constants only.