rippled
Loading...
Searching...
No Matches
RCLCxLedger.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012-2016 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_APP_CONSENSUS_RCLCXLEDGER_H_INCLUDED
21#define RIPPLE_APP_CONSENSUS_RCLCXLEDGER_H_INCLUDED
22
23#include <xrpld/app/ledger/Ledger.h>
24#include <xrpld/app/ledger/LedgerToJson.h>
25
26#include <xrpl/ledger/ReadView.h>
27#include <xrpl/protocol/RippleLedgerHash.h>
28
29namespace ripple {
30
36{
37public:
39 using ID = LedgerHash;
42
49 RCLCxLedger() = default;
50
58
60 Seq const&
61 seq() const
62 {
63 return ledger_->info().seq;
64 }
65
67 ID const&
68 id() const
69 {
70 return ledger_->info().hash;
71 }
72
74 ID const&
75 parentID() const
76 {
77 return ledger_->info().parentHash;
78 }
79
83 {
84 return ledger_->info().closeTimeResolution;
85 }
86
88 bool
89 closeAgree() const
90 {
91 return ripple::getCloseAgree(ledger_->info());
92 }
93
96 closeTime() const
97 {
98 return ledger_->info().closeTime;
99 }
100
104 {
105 return ledger_->info().parentCloseTime;
106 }
107
110 getJson() const
111 {
112 return ripple::getJson({*ledger_, {}});
113 }
114
121};
122} // namespace ripple
123#endif
Represents a JSON value.
Definition json_value.h:149
Represents a ledger in RCLConsensus.
Definition RCLCxLedger.h:36
NetClock::duration closeTimeResolution() const
Resolution used when calculating this ledger's close time.
Definition RCLCxLedger.h:82
Seq const & seq() const
Sequence number of the ledger.
Definition RCLCxLedger.h:61
NetClock::time_point parentCloseTime() const
The close time of this ledger's parent.
RCLCxLedger(std::shared_ptr< Ledger const > const &l)
Constructor.
Definition RCLCxLedger.h:55
ID const & id() const
Unique identifier (hash) of this ledger.
Definition RCLCxLedger.h:68
std::shared_ptr< Ledger const > ledger_
The ledger instance.
LedgerHash ID
Unique identifier of a ledger.
Definition RCLCxLedger.h:39
RCLCxLedger()=default
Default constructor.
NetClock::time_point closeTime() const
The close time of this ledger.
Definition RCLCxLedger.h:96
LedgerIndex Seq
Sequence number of a ledger.
Definition RCLCxLedger.h:41
Json::Value getJson() const
JSON representation of this ledger.
ID const & parentID() const
Unique identifier (hash) of this ledger's parent.
Definition RCLCxLedger.h:75
bool closeAgree() const
Whether consensus process agreed on close time of the ledger.
Definition RCLCxLedger.h:89
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
bool getCloseAgree(LedgerHeader const &info)
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:136
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
uint256 LedgerHash