rippled
Loading...
Searching...
No Matches
LedgerHeader.h
1#ifndef XRPL_PROTOCOL_LEDGERHEADER_H_INCLUDED
2#define XRPL_PROTOCOL_LEDGERHEADER_H_INCLUDED
3
4#include <xrpl/basics/Slice.h>
5#include <xrpl/basics/base_uint.h>
6#include <xrpl/basics/chrono.h>
7#include <xrpl/protocol/Protocol.h>
8#include <xrpl/protocol/Serializer.h>
9#include <xrpl/protocol/XRPAmount.h>
10
11namespace xrpl {
12
15{
16 explicit LedgerHeader() = default;
17
18 //
19 // For all ledgers
20 //
21
24
25 //
26 // For closed ledgers
27 //
28
29 // Closed means "tx set already determined"
30 uint256 hash = beast::zero;
31 uint256 txHash = beast::zero;
32 uint256 accountHash = beast::zero;
33 uint256 parentHash = beast::zero;
34
35 XRPAmount drops = beast::zero;
36
37 // If validated is false, it means "not yet validated."
38 // Once validated is true, it will never be set false at a later time.
39 // VFALCO TODO Make this not mutable
40 bool mutable validated = false;
41 bool accepted = false;
42
43 // flags indicating how this ledger close took place
44 int closeFlags = 0;
45
46 // the resolution for this ledger close time (2-120 seconds)
48
49 // For closed ledgers, the time the ledger
50 // closed. For open ledgers, the time the ledger
51 // will close if there's no transactions.
52 //
54};
55
56// ledger close flags
58
59inline bool
61{
62 return (info.closeFlags & sLCF_NoConsensusTime) == 0;
63}
64
65void
66addRaw(LedgerHeader const&, Serializer&, bool includeHash = false);
67
69LedgerHeader
70deserializeHeader(Slice data, bool hasHash = false);
71
73LedgerHeader
74deserializePrefixedHeader(Slice data, bool hasHash = false);
75
76} // namespace xrpl
77
78#endif
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
bool getCloseAgree(LedgerHeader const &info)
LedgerHeader deserializeHeader(Slice data, bool hasHash=false)
Deserialize a ledger header from a byte array.
void addRaw(LedgerHeader const &, Serializer &, bool includeHash=false)
static std::uint32_t const sLCF_NoConsensusTime
LedgerHeader deserializePrefixedHeader(Slice data, bool hasHash=false)
Deserialize a ledger header (prefixed with 4 bytes) from a byte array.
Information about the notional ledger backing the view.
NetClock::time_point parentCloseTime
LedgerHeader()=default
NetClock::duration closeTimeResolution
NetClock::time_point closeTime