Skip to content

Commit 0b2f7ae

Browse files
committed
Remove inLedger from API version 2
1 parent cda04a0 commit 0b2f7ae

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

src/ripple/app/misc/Transaction.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <ripple/protocol/STTx.h>
2828
#include <ripple/protocol/TER.h>
2929
#include <ripple/protocol/TxMeta.h>
30-
#include <boost/optional.hpp>
30+
3131
#include <optional>
3232
#include <variant>
3333

@@ -310,6 +310,7 @@ class Transaction : public std::enable_shared_from_this<Transaction>,
310310
getJson(
311311
JsonOptions options,
312312
bool binary = false,
313+
bool showInLedger = false,
313314
std::optional<std::reference_wrapper<std::string>> hash = {}) const;
314315

315316
// Information used to locate a transaction.

src/ripple/app/misc/impl/Transaction.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,16 @@ Json::Value
168168
Transaction::getJson(
169169
JsonOptions options,
170170
bool binary,
171+
bool showInLedger,
171172
std::optional<std::reference_wrapper<std::string>> hash) const
172173
{
173174
Json::Value ret(mTransaction->getJson(JsonOptions::none, binary, hash));
174175

175176
if (mInLedger)
176177
{
177-
ret[jss::inLedger] = mInLedger; // Deprecated.
178+
if (showInLedger)
179+
ret[jss::inLedger] = mInLedger; // Deprecated.
180+
178181
ret[jss::ledger_index] = mInLedger;
179182

180183
if (options == JsonOptions::include_date)

src/ripple/rpc/handlers/AccountTx.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,15 @@ populateJsonResponse(
332332
{
333333
std::string hash;
334334
jvObj[json_tx] = txn->getJson(
335-
JsonOptions::include_date, false, {std::ref(hash)});
335+
JsonOptions::include_date,
336+
false,
337+
false,
338+
{std::ref(hash)});
336339
jvObj[jss::hash] = hash;
337340
}
338341
else
339-
jvObj[json_tx] =
340-
txn->getJson(JsonOptions::include_date);
342+
jvObj[json_tx] = txn->getJson(
343+
JsonOptions::include_date, false, true);
341344

342345
auto const& sttx = txn->getSTransaction();
343346
RPC::insertDeliverMax(

src/ripple/rpc/handlers/Tx.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,11 @@ populateJsonResponse(
328328
std::string hash;
329329
if (args.binary)
330330
response[jss::tx_blob] = result.txn->getJson(
331-
JsonOptions::include_date, true, {std::ref(hash)});
331+
JsonOptions::include_date, true, false, {std::ref(hash)});
332332
else
333333
{
334334
response[jss::tx_json] = result.txn->getJson(
335-
JsonOptions::include_date, false, {std::ref(hash)});
335+
JsonOptions::include_date, false, false, {std::ref(hash)});
336336
RPC::insertDeliverMax(
337337
response[jss::tx_json],
338338
sttx->getTxnType(),
@@ -345,8 +345,8 @@ populateJsonResponse(
345345
}
346346
else
347347
{
348-
response =
349-
result.txn->getJson(JsonOptions::include_date, args.binary);
348+
response = result.txn->getJson(
349+
JsonOptions::include_date, args.binary, true);
350350
if (!args.binary)
351351
RPC::insertDeliverMax(
352352
response, sttx->getTxnType(), context.apiVersion);

src/ripple/rpc/impl/TransactionSign.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,13 @@ transactionFormatResultImpl(Transaction::pointer tpTrans, unsigned apiVersion)
653653
if (apiVersion > 1)
654654
{
655655
std::string hash = {};
656-
jvResult[jss::tx_json] =
657-
tpTrans->getJson(JsonOptions::none, false, {std::ref(hash)});
656+
jvResult[jss::tx_json] = tpTrans->getJson(
657+
JsonOptions::none, false, false, {std::ref(hash)});
658658
jvResult[jss::hash] = hash;
659659
}
660660
else
661-
jvResult[jss::tx_json] = tpTrans->getJson(JsonOptions::none);
661+
jvResult[jss::tx_json] =
662+
tpTrans->getJson(JsonOptions::none, false, true);
662663

663664
jvResult[jss::tx_blob] =
664665
strHex(tpTrans->getSTransaction()->getSerializer().peekData());

0 commit comments

Comments
 (0)