xrpld
Loading...
Searching...
No Matches
xrpl::test::csf::LedgerOracle Class Reference

Oracle maintaining unique ledgers for a simulation. More...

#include <ledgers.h>

Public Member Functions

 LedgerOracle ()
std::optional< Ledgerlookup (Ledger::ID const &id) const
 Find the ledger with the given ID.
Ledger accept (Ledger const &curr, TxSetType const &txs, NetClock::duration closeTimeResolution, NetClock::time_point const &consensusCloseTime)
 Accept the given txs and generate a new ledger.
Ledger accept (Ledger const &curr, Tx tx)

Static Public Member Functions

static std::size_t branches (std::set< Ledger > const &ledgers)
 Determine the number of distinct branches for the set of ledgers.

Private Types

using InstanceMap
using InstanceEntry = InstanceMap::value_type

Private Member Functions

Ledger::ID nextID () const

Private Attributes

InstanceMap instances_

Detailed Description

Oracle maintaining unique ledgers for a simulation.

Definition at line 226 of file ledgers.h.

Member Typedef Documentation

◆ InstanceMap

Initial value:
boost::bimaps::bimap<
boost::bimaps::set_of<Ledger::Instance, xrpl::less<Ledger::Instance>>,
boost::bimaps::set_of<Ledger::ID, xrpl::less<Ledger::ID>>>

Definition at line 228 of file ledgers.h.

◆ InstanceEntry

using xrpl::test::csf::LedgerOracle::InstanceEntry = InstanceMap::value_type
private

Definition at line 231 of file ledgers.h.

Constructor & Destructor Documentation

◆ LedgerOracle()

xrpl::test::csf::LedgerOracle::LedgerOracle ( )

Definition at line 77 of file ledgers.cpp.

Member Function Documentation

◆ nextID()

Ledger::ID xrpl::test::csf::LedgerOracle::nextID ( ) const
nodiscardprivate

Definition at line 83 of file ledgers.cpp.

◆ lookup()

std::optional< Ledger > xrpl::test::csf::LedgerOracle::lookup ( Ledger::ID const & id) const
nodiscard

Find the ledger with the given ID.

Definition at line 124 of file ledgers.cpp.

◆ accept() [1/2]

Ledger xrpl::test::csf::LedgerOracle::accept ( Ledger const & curr,
TxSetType const & txs,
NetClock::duration closeTimeResolution,
NetClock::time_point const & consensusCloseTime )

Accept the given txs and generate a new ledger.

Parameters
currThe current ledger
txsThe transactions to apply to the current ledger
closeTimeResolutionResolution used in determining close time
consensusCloseTimeThe consensus agreed close time, no valid time if 0

Definition at line 89 of file ledgers.cpp.

◆ accept() [2/2]

Ledger xrpl::test::csf::LedgerOracle::accept ( Ledger const & curr,
Tx tx )

Definition at line 263 of file ledgers.h.

◆ branches()

std::size_t xrpl::test::csf::LedgerOracle::branches ( std::set< Ledger > const & ledgers)
static

Determine the number of distinct branches for the set of ledgers.

Ledgers A and B are on different branches if A != B, A is not an ancestor of B and B is not an ancestor of A, e.g.

/--> A O --> B

Definition at line 135 of file ledgers.cpp.

Member Data Documentation

◆ instances_

InstanceMap xrpl::test::csf::LedgerOracle::instances_
private

Definition at line 234 of file ledgers.h.