Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Nov 2, 2023
1 parent 95b6055 commit b2a8a2d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ripple/rpc/handlers/Tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ populateJsonResponse(
context.apiVersion);
}

// Note, result.ledgerHash is only set in a closed or validated
// ledger - as seen in `doTxHelp` and `doTxPostgres`
if (result.ledgerHash)
response[jss::ledger_hash] = to_string(*result.ledgerHash);

Expand Down
2 changes: 1 addition & 1 deletion src/test/rpc/TransactionEntry_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class TransactionEntry_test : public beast::unit_test::suite
BEAST_EXPECT(resIndex[jss::validated] == true);
BEAST_EXPECT(!resIndex[jss::tx_json].isMember(jss::Amount));

if (!close_time_iso.empty())
if (BEAST_EXPECT(!close_time_iso.empty()))
BEAST_EXPECT(
resIndex[jss::close_time_iso] == close_time_iso);
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/rpc/Transaction_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,11 @@ class Transaction_test : public beast::unit_test::suite
result[jss::result][jss::hash] ==
to_string(txn->getTransactionID()));
BEAST_EXPECT(result[jss::result][jss::validated] == true);
BEAST_EXPECT(result[jss::result][jss::ledger_index] == 4);
BEAST_EXPECT(
result[jss::result][jss::ledger_hash] ==
"B41882E20F0EC6228417D28B9AE0F33833645D35F6799DFB782AC97FC4BB51"
"D2");
}

for (auto memberIt = expected.begin(); memberIt != expected.end();
Expand Down

0 comments on commit b2a8a2d

Please sign in to comment.