rippled
Loading...
Searching...
No Matches
LedgerHeader.h
1#pragma once
2
3#include <xrpl/basics/Slice.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/basics/chrono.h>
6#include <xrpl/protocol/Protocol.h>
7#include <xrpl/protocol/Serializer.h>
8#include <xrpl/protocol/XRPAmount.h>
9
10namespace xrpl {
11
14{
15 explicit LedgerHeader() = default;
16
17 //
18 // For all ledgers
19 //
20
23
24 //
25 // For closed ledgers
26 //
27
28 // Closed means "tx set already determined"
29 uint256 hash = beast::zero;
30 uint256 txHash = beast::zero;
31 uint256 accountHash = beast::zero;
32 uint256 parentHash = beast::zero;
33
34 XRPAmount drops = beast::zero;
35
36 // If validated is false, it means "not yet validated."
37 // Once validated is true, it will never be set false at a later time.
38 // VFALCO TODO Make this not mutable
39 bool mutable validated = false;
40 bool accepted = false;
41
42 // flags indicating how this ledger close took place
43 int closeFlags = 0;
44
45 // the resolution for this ledger close time (2-120 seconds)
47
48 // For closed ledgers, the time the ledger
49 // closed. For open ledgers, the time the ledger
50 // will close if there's no transactions.
51 //
53};
54
55// ledger close flags
57
58inline bool
60{
61 return (info.closeFlags & sLCF_NoConsensusTime) == 0;
62}
63
64void
65addRaw(LedgerHeader const&, Serializer&, bool includeHash = false);
66
68LedgerHeader
69deserializeHeader(Slice data, bool hasHash = false);
70
72LedgerHeader
73deserializePrefixedHeader(Slice data, bool hasHash = false);
74
75} // namespace xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
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