xrpld
Loading...
Searching...
No Matches
LedgerClosed.cpp
1#include <xrpld/app/ledger/LedgerMaster.h>
2#include <xrpld/rpc/Context.h>
3
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/json/json_value.h>
7#include <xrpl/protocol/jss.h>
8#include <xrpl/server/NetworkOPs.h>
9
10namespace xrpl {
11
12json::Value
14{
15 auto ledger = context.ledgerMaster.getClosedLedger();
16 XRPL_ASSERT(ledger, "xrpl::doLedgerClosed : non-null closed ledger");
17
18 json::Value jvResult;
19 jvResult[jss::ledger_index] = ledger->header().seq;
20 jvResult[jss::ledger_hash] = to_string(ledger->header().hash);
21
22 return jvResult;
23}
24
25} // namespace xrpl
Represents a JSON value.
Definition json_value.h:130
std::shared_ptr< Ledger const > getClosedLedger()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition base_uint.h:633
json::Value doLedgerClosed(RPC::JsonContext &)
LedgerMaster & ledgerMaster
Definition Context.h:24