refactor: Fill txJson based on apiVersion (#7109)

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
This commit is contained in:
rrmanukyan
2026-05-12 15:27:07 -04:00
committed by Bart
parent 9433fede5f
commit 02a5bcaf23

View File

@@ -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;
}
}
}