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 ripple {
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// We call them "headers" in conversation
57// but "info" in code. Unintuitive.
58// This alias lets us give the "correct" name to the class
59// without yet disturbing existing uses.
61
62// ledger close flags
64
65inline bool
67{
68 return (info.closeFlags & sLCF_NoConsensusTime) == 0;
69}
70
71void
72addRaw(LedgerHeader const&, Serializer&, bool includeHash = false);
73
75LedgerHeader
76deserializeHeader(Slice data, bool hasHash = false);
77
79LedgerHeader
80deserializePrefixedHeader(Slice data, bool hasHash = false);
81
82} // namespace ripple
83
84#endif
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
LedgerHeader deserializePrefixedHeader(Slice data, bool hasHash=false)
Deserialize a ledger header (prefixed with 4 bytes) from a byte array.
bool getCloseAgree(LedgerHeader const &info)
static std::uint32_t const sLCF_NoConsensusTime
void addRaw(LedgerHeader const &, Serializer &, bool includeHash=false)
LedgerHeader deserializeHeader(Slice data, bool hasHash=false)
Deserialize a ledger header from a byte array.
Information about the notional ledger backing the view.
NetClock::time_point closeTime
NetClock::duration closeTimeResolution
NetClock::time_point parentCloseTime