Skip to content

Commit

Permalink
Fix validated and close_time_iso in account_tx
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Nov 2, 2023
1 parent cdb3384 commit 5973390
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
11 changes: 6 additions & 5 deletions src/ripple/rpc/handlers/AccountTx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ populateJsonResponse(
jvObj[jss::ledger_hash] =
to_string(context.ledgerMaster.getHashBySeq(
txn->getLedger()));

if (auto closeTime =
context.ledgerMaster.getCloseTimeBySeq(
txn->getLedger()))
jvObj[jss::close_time_iso] =
to_string_iso(*closeTime);
}
else
jvObj[json_tx] = txn->getJson(
Expand All @@ -356,11 +362,6 @@ populateJsonResponse(
insertDeliveredAmount(
jvObj[jss::meta], context, txn, *txnMeta);
insertNFTSyntheticInJson(jvObj, sttx, *txnMeta);
if (auto closeTime =
context.ledgerMaster.getCloseTimeBySeq(
txnMeta->getIndex()))
jvObj[jss::close_time_iso] =
to_string_iso(*closeTime);
}
}
}
Expand Down
35 changes: 27 additions & 8 deletions src/test/rpc/AccountTx_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,36 @@ class AccountTx_test : public beast::unit_test::suite
j[jss::result][jss::transactions][1u][jss::tx]
[jss::DeliverMax]);
case 2:
return j.isMember(jss::result) &&
if (j.isMember(jss::result) &&
(j[jss::result][jss::status] == "success") &&
(j[jss::result][jss::transactions].size() == 2) &&
(j[jss::result][jss::transactions][0u][jss::tx_json]
[jss::TransactionType] == jss::AccountSet) &&
(j[jss::result][jss::transactions][1u][jss::tx_json]
[jss::TransactionType] == jss::Payment) &&
(j[jss::result][jss::transactions][1u][jss::tx_json]
[jss::DeliverMax] == "10000000010") &&
(!j[jss::result][jss::transactions][1u][jss::tx_json]
.isMember(jss::Amount));
[jss::TransactionType] == jss::AccountSet))
{
auto const& payment =
j[jss::result][jss::transactions][1u];

return (payment.isMember(jss::tx_json)) &&
(payment[jss::tx_json][jss::TransactionType] ==
jss::Payment) &&
(payment[jss::tx_json][jss::DeliverMax] ==
"10000000010") &&
(!payment[jss::tx_json].isMember(jss::Amount)) &&
(!payment[jss::tx_json].isMember(jss::hash)) &&
(payment[jss::hash] ==
"9F3085D85F472D1CC29627F260DF68EDE59D42D1D0C33E345"
"ECF0D4CE981D0A8") &&
(payment[jss::validated] == true) &&
(payment[jss::ledger_index] == 3) &&
(payment[jss::ledger_hash] ==
"5476DCD816EA04CBBA57D47BBF1FC58A5217CC93A5ADD79CB"
"580A5AFDD727E33") &&
(payment[jss::close_time_iso] ==
"2000-01-01T00:00:10Z");
}
else
return false;

default:
return false;
}
Expand Down

0 comments on commit 5973390

Please sign in to comment.