From 652b0c0dbf5efea633f39df1f222752a366718ae Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 23 Sep 2026 14:29:18 +0100 Subject: [PATCH] fix(telemetry): Skip the fee span attribute for a non-XRP fee The tx.process span read the fee with STAmount::xrp(), which throws on a non-native amount. preflight1 rejects such a transaction with temBAD_FEE, but the attribute runs first, so with tracing on the submit RPC returned internalSubmit instead. Turning tracing on must not change a response. Guard on native() and leave the attribute out otherwise. The peer path was already contained by its own catch. --- src/xrpld/app/misc/NetworkOPs.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 3ecb2a4e1c..e4c16bd85c 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -1561,10 +1561,16 @@ NetworkOPsImp::processTransaction( { if (auto const* fmt = TxFormats::getInstance().findByType(stx->getTxnType())) span->setAttribute(tx_span::attr::txType, fmt->getName().c_str()); + // xrp() throws on a non-XRP fee. preflight rejects such a + // transaction with temBAD_FEE, so leave the attribute out rather + // than let tracing turn that into an internal error. + if (auto const& fee = stx->getFieldAmount(sfFee); fee.native()) + { + span->setAttribute( + tx_span::attr::fee, static_cast(fee.xrp().drops())); + } span->setAttribute( - tx_span::attr::fee, static_cast(stx->getFieldAmount(sfFee).xrp().drops())); - span->setAttribute( - tx_span::attr::sequence, static_cast(stx->getSeqProxy().value())); + tx_span::attr::sequence, static_cast(stx->getSeqProxy().value())); } }