Skip to content

Commit

Permalink
Store closeTime in LedgerFill
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Oct 26, 2023
1 parent 1115cef commit 4e92ee4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/ripple/app/ledger/LedgerToJson.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
#define RIPPLE_APP_LEDGER_LEDGERTOJSON_H_INCLUDED

#include <ripple/app/ledger/Ledger.h>
#include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/app/misc/TxQ.h>
#include <ripple/basics/StringUtilities.h>
#include <ripple/basics/chrono.h>
#include <ripple/json/Object.h>
#include <ripple/protocol/STTx.h>
#include <ripple/protocol/jss.h>
Expand All @@ -41,6 +43,8 @@ struct LedgerFill
LedgerEntryType t = ltANY)
: ledger(l), options(o), txQueue(std::move(q)), type(t), context(ctx)
{
if (context)
closeTime = context->ledgerMaster.getCloseTimeBySeq(ledger.seq());
}

enum Options {
Expand All @@ -58,6 +62,7 @@ struct LedgerFill
std::vector<TxQ::TxDetails> txQueue;
LedgerEntryType type;
RPC::Context* context;
std::optional<NetClock::time_point> closeTime;
};

/** Given a Ledger and options, fill a Json::Object or Json::Value with a
Expand Down
7 changes: 3 additions & 4 deletions src/ripple/app/ledger/impl/LedgerToJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,9 @@ fillJsonTx(
{
txJson[jss::ledger_index] = to_string(fill.ledger.seq());
txJson[jss::ledger_hash] = to_string(fill.ledger.info().hash);
if (auto close_time =
fill.context->ledgerMaster.getCloseTimeBySeq(
fill.ledger.seq()))
txJson[jss::close_time_iso] = to_string_iso(*close_time);
if (fill.closeTime)
txJson[jss::close_time_iso] =
to_string_iso(*fill.closeTime);
}
}
else
Expand Down

0 comments on commit 4e92ee4

Please sign in to comment.