From 02a5bcaf2388d05de916722a4e664fd4ab30afb0 Mon Sep 17 00:00:00 2001 From: rrmanukyan Date: Tue, 12 May 2026 15:27:07 -0400 Subject: [PATCH] refactor: Fill txJson based on apiVersion (#7109) Co-authored-by: Ayaz Salikhov --- src/xrpld/app/ledger/detail/LedgerToJson.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/xrpld/app/ledger/detail/LedgerToJson.cpp b/src/xrpld/app/ledger/detail/LedgerToJson.cpp index 10a3e5c0bd..7c03e22580 100644 --- a/src/xrpld/app/ledger/detail/LedgerToJson.cpp +++ b/src/xrpld/app/ledger/detail/LedgerToJson.cpp @@ -297,13 +297,24 @@ fillJsonQueue(json::Value& json, LedgerFill const& fill) txJson["last_result"] = transToken(*tx.lastResult); auto&& temp = fillJsonTx(fill, bBinary, bExpanded, tx.txn, nullptr); - if (fill.context->apiVersion > 1) + if (temp.isObject()) { - copyFrom(txJson, temp); + if (fill.context->apiVersion > 1) + { + copyFrom(txJson, temp); + } + else + { + copyFrom(txJson[jss::tx], temp); + } + } + else if (fill.context->apiVersion > 1) + { + txJson[jss::hash] = temp; } else { - copyFrom(txJson[jss::tx], temp); + txJson[jss::tx] = temp; } } }