mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-28 15:58:07 +00:00
Both tx.receive and tx.process set their attributes unconditionally, so the work happened even when nothing consumed it: a 64-char hash string allocation, a getCurrentLedgerIndex() call that takes the ledger master's lock, a TxFormats lookup, a peer-version string copy, and in tx.process a fee and sequence decode. tx.receive runs before the duplicate check, so duplicate relays paid for it too. Guard both blocks on the span being live. When telemetry is compiled out the guard's operator bool() is a literal false and the block is eliminated; when it is compiled in the block is skipped for any span that is not being recorded, which the previous code could not do. Behaviour is unchanged where the span is live, and setAttribute on a null guard was already a no-op. The remaining attributes at the exit paths keep their unconditional calls: their arguments are compile-time constants, so there is nothing to save.