rippled
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Attributes | Friends | List of all members
xrpl::RCLValidatedLedger Class Reference

Wraps a ledger instance for use in generic Validations LedgerTrie. More...

#include <RCLValidations.h>

Collaboration diagram for xrpl::RCLValidatedLedger:
Collaboration graph
[legend]

Classes

struct  MakeGenesis
 

Public Types

using ID = LedgerHash
 
using Seq = LedgerIndex
 

Public Member Functions

 RCLValidatedLedger (MakeGenesis)
 
 RCLValidatedLedger (std::shared_ptr< Ledger const > const &ledger, beast::Journal j)
 
Seq seq () const
 The sequence (index) of the ledger.
 
ID id () const
 The ID (hash) of the ledger.
 
ID operator[] (Seq const &s) const
 Lookup the ID of the ancestor ledger.
 
Seq minSeq () const
 

Private Attributes

ID ledgerID_
 
Seq ledgerSeq_
 
std::vector< uint256ancestors_
 
beast::Journal j_
 

Friends

Seq mismatch (RCLValidatedLedger const &a, RCLValidatedLedger const &b)
 Find the sequence number of the earliest mismatching ancestor.
 

Detailed Description

Wraps a ledger instance for use in generic Validations LedgerTrie.

The LedgerTrie models a ledger's history as a map from Seq -> ID. Any two ledgers that have the same ID for a given Seq have the same ID for all earlier sequences (e.g. shared ancestry). In practice, a ledger only conveniently has the prior 256 ancestor hashes available. For RCLValidatedLedger, we treat any ledgers separated by more than 256 Seq as distinct.

Definition at line 138 of file RCLValidations.h.

Member Typedef Documentation

◆ ID

Definition at line 141 of file RCLValidations.h.

◆ Seq

Definition at line 142 of file RCLValidations.h.

Constructor & Destructor Documentation

◆ RCLValidatedLedger() [1/2]

xrpl::RCLValidatedLedger::RCLValidatedLedger ( MakeGenesis  )

Definition at line 18 of file RCLValidations.cpp.

◆ RCLValidatedLedger() [2/2]

xrpl::RCLValidatedLedger::RCLValidatedLedger ( std::shared_ptr< Ledger const > const &  ledger,
beast::Journal  j 
)

Definition at line 22 of file RCLValidations.cpp.

Member Function Documentation

◆ seq()

auto xrpl::RCLValidatedLedger::seq ( ) const

The sequence (index) of the ledger.

Definition at line 45 of file RCLValidations.cpp.

◆ id()

auto xrpl::RCLValidatedLedger::id ( ) const

The ID (hash) of the ledger.

Definition at line 50 of file RCLValidations.cpp.

◆ operator[]()

auto xrpl::RCLValidatedLedger::operator[] ( Seq const &  s) const

Lookup the ID of the ancestor ledger.

Parameters
sThe sequence (index) of the ancestor
Returns
The ID of this ledger's ancestor with that sequence number or ID{0} if one was not determined

Definition at line 56 of file RCLValidations.cpp.

◆ minSeq()

auto xrpl::RCLValidatedLedger::minSeq ( ) const

Definition at line 39 of file RCLValidations.cpp.

Friends And Related Symbol Documentation

◆ mismatch

Seq mismatch ( RCLValidatedLedger const &  a,
RCLValidatedLedger const &  b 
)
friend

Find the sequence number of the earliest mismatching ancestor.

Definition at line 74 of file RCLValidations.cpp.

Member Data Documentation

◆ ledgerID_

ID xrpl::RCLValidatedLedger::ledgerID_
private

Definition at line 177 of file RCLValidations.h.

◆ ledgerSeq_

Seq xrpl::RCLValidatedLedger::ledgerSeq_
private

Definition at line 178 of file RCLValidations.h.

◆ ancestors_

std::vector<uint256> xrpl::RCLValidatedLedger::ancestors_
private

Definition at line 179 of file RCLValidations.h.

◆ j_

beast::Journal xrpl::RCLValidatedLedger::j_
private

Definition at line 180 of file RCLValidations.h.