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.
This commit is contained in:
Pratik Mankawde
2026-09-23 14:29:18 +01:00
parent c23646c279
commit 652b0c0dbf

View File

@@ -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<std::int64_t>(fee.xrp().drops()));
}
span->setAttribute(
tx_span::attr::fee, static_cast<int64_t>(stx->getFieldAmount(sfFee).xrp().drops()));
span->setAttribute(
tx_span::attr::sequence, static_cast<int64_t>(stx->getSeqProxy().value()));
tx_span::attr::sequence, static_cast<std::int64_t>(stx->getSeqProxy().value()));
}
}